There are several possible reasons.
Let’s start by checking if the mail protocol is enabled in PHP on your server. If you have access to your server’s
php.inifile, look for
smtp_port. Mine looks like this:
[mail function] SMTP = localhost smtp_port = 25
If you don’t have access to the
php.inifile, then create a file called
phpinfo.phpin your root directory and add this line to it:
<?php phpinfo(); ?>
View this in your browser (i.e. http://www.mydomain.com/phpinfo.php) and search the page for
smtp_port. Delete the file when you’re done so as not to expose any configuration details to prying eyes.
(Aside: I like to run this page once, copy the page to my Evernote so I have the details for just such an occasion, then delete the page.)
Or ask your web host tech support if SMTP is enabled in PHP.
mine looks the same as yours. now what?
SMTP localhost localhost
smtp_port 25 25
Good. Now let’s check if the WordPress mail function is working. Use the example script on this site:
Good. So let’s look at the values the plugin is working with. Add this before the
echo 'To: '.$to.'<br>Subject: '.$subject.'<br>Message: '.$message.'<br>Headers: '.$headers;
Line 604 if you’re using an editor, or just edit the plugin via the admin screen and search for
Then add a testimonial using the form. This will show the values right before being sent to
wp_mail. No need to post the results, just let me know if the To: address and the From: address in the
I’m just going to post it all instead of trying to explain what i see.
Subject: Testimonial Submission on Progressive Landscapes
Message: You have received a testimonial submission on Progressive Landscapes. This is awaiting action from the administrator of the website.
Headers: From: firstname.lastname@example.org X-Mailer: PHP/5.2.17
thank you so much for walking me through this so far.
i have also checked my spam and its not in there either.
I’m glad to help. We’ve ruled out the obvious. You can remove that line of code if you haven’t already.
Let’s try this plugin:
It adds more control over the mail function.
Select the options for
Use the PHP mail() function to send emails.
No: Do not use SMTP authentication.
and be sure to click [Save Changes].
Then, at the the bottom of that admin page, try a test email. It will tell you whether or not it was able to send.
If it fails, it lists out the variables and error codes so we’ll need those – just copy that section to Notepad or something and we’ll go from there.
test email worked. testimonial email notification still not working.
Good, getting closer. I think your web host’s security settings are bit tighter than average. That’s a good thing.
Let’s try this. In
testimonials.php, at line 602 (a couple lines above the
wp_mailwe searched for before):
Disable this line by adding 2 slashes in front like this:
// $headers = 'From: noreply@'.$_SERVER['HTTP_HOST'] . "\r\n" . 'X-Mailer: PHP/' . phpversion();
then add this line right below it:
$headers = 'From: noreply@'.str_replace('www.','',$_SERVER['HTTP_HOST']);
We’re fixing two things here. (1) The headers don’t need the
X-Mailerpart because the wp_mail function already includes that. (2) Your web host may not like the
wwwin the email address.
voila! it works! thanks!
after all that, i’m kinda disappointed by the email structure/content. i thought it would be more interactive like a comment moderation notification email where the admin wouldn’t have to log in to the website to approve or deny.
Very impressive, Chris. Thanks for sharing your knowledge. The topic isn’t relevant to me but I love the way you processed the problem and found the solution.
A thing of beauty.
- The topic ‘Admin Email Notification’ is closed to new replies.