WordPress has grown from a blogging platform to become a highly efficient CMS. Chances are high that you are using a contact form on your WordPress. Imagine if a prospective client fills up your contact form but WordPress fails to send you an email notification!
If you are facing problems like these, you should do the following:
First check if PHP-scripts can send emails
php -a mail ('[email protected]', "Test Postfix", "Test mail from postfix"); exit ();
Note: if after running php -a
, you get "Interactive mode enabled"
message but no php>
prompt, then your PHP is not compiled with readline support. If its working nice, you will get only "Interactive mode"
message with php>
prompt.
You can still run test though. Just create a testmail.php
with following lines of codes:
<?php mail ('[email protected]', "Test Postfix", "Test mail from postfix"); ?>
and run it on your server with php -f testmail.php
command. If you can’t see any email form PHP, then that means its PHP’s fault.
Check value of sendmail_path
in php.ini config. If its wrong, fix it and run above test again.
Check if WordPress can send emails
Testing WordPress is easy. You can do it using this plugin. I know that plugin is not updated from 2 years but I tested it with WordPress 3.4 without any issue. Its a simple plugin so chances are very less that it will break in future as well! 😉
Now if in your test you can send emails but still facing issues with contact form, its better to check your plugins then. Mostly likely it will be some coding issue.
Hello!
What is sendmail_path in php.ini?
Thank you!
Its a path to sendmail program on your server.
On Linux, just run command:
It will show you path like:
In my case, value of “sendmail_path” is “/usr/sbin/sendmail -t -i -f [email protected]“. This is system default as I never needed to change it.
I’m doing all of this assistance. does not work :/
Sorry but I couldn’t understood what you wanted to say.
Please ask your question more clearly (may be with some details).
Thanks for your guides
Im in the process of setting my own ubuntu box up with WordPress and postfix.
It sends okay with the command
echo "Test from Postfix" | mail -s "Test" [email protected]
It also sends okay via the php commands you mentioned above. However it doesnt send via wordpress. Using the plugin it goes but never gets delivered. mail.log shows no entry.
Any ideas where to look?
Please check
error.log
file for WordPress. Most likely it will be available at/var/www/domain.com/logs/error.log
.Also, you can disable other WordPress plugins and check if WordPress can send emails.
Thanks. I found the issue in the end. In the apache logs it was pointing to the wrong path for sendmail. Was missing the / before /usr/
@Dale
Glad to know that your issue got fixed. 🙂
I can send and receive the email using echo “Test from Postfix” | mail -s “Test” [email protected] but when I tried using “check email” plugin in WordPress, it didn’t work.
@Ken
Sorry for delayed reply. If you are facing issues as of now, please send error logs.
Jul 22 16:56:12 smith postfix/error[19857]: BC723A061: to=, relay=none, delay=0.01, delays=0/0/0/0, dsn=5.0.0, status=bounced (gmx.de)
POSTFIX
# postconf -d | grep mail_version
mail_version = 2.7.1
milter_macro_v = $mail_name $mail_version
@Andree
I did not get what you are trying to ask?
Sorry, this is too advanced for me. Could you please give me a brief description of how to find that PHP snippet or how to “run” it? Do I have to type it in somewhere or do I find it in my wordpress files?
Its better to install this plugin – http://wordpress.org/extend/plugins/check-email/
That way you wont need to get into coding. If you can send mails using above plugin, then most likely PHP-mail sending is working fine.
Thanks for the troubleshooting steps. I have followed them
Check point 1 – no issues with PHP setting e-mail goes
Checkpoint 2 – the plugin says “The test email has been sent by WordPress” but actually e-mail is not received. It looks all weird. Any clues on what’s happening to me?
Check postfix logs and wordpress error logs. Most likely its an issue with WordPress.
Or you might have added your test email address' domain in postfix's
mydestination
list.I used check mail today with WordPress 3.5.1 and it still works great. I was able to fix some email issues in seconds.
Great post by the way.
Thanks a lot .. it helped me a lot .. In ubuntu we just have to type sudo apt-get install sendmail and then you can send email from wordpress.
It’s better to use postfix. It’s sendmail compatible and is more powerful.
You can try it if you ever run into issues with sendmail.
I have configure but I am not able to send any mail using the following command
echo “Test mail from postfix” | mail -s “Test Postfix” [email protected]
pls help me out
Please try https://rtcamp.com/tutorials/mail/postfix-debugging/
Hello guys,
My name is Paula, I’m venturing on WordPress and I am creating my own website. I take this opportunity to apologize for my English because I am Brazilian and my English is not perfect yet. But I think you will understand me and help me 🙂
I bought a theme on ThemeForest, i’m installation normally, but the contact form is having problems with the variables used.
Let me explain: the form has 3 fields (Name , Email and Message), the visitor fills out and submits, however, get only the name and email address of the visitor, but the message that I do not get visitor wrote.
I am in contact with the support of the theme for almost 10 days and are not solving. Perhaps because of problems with their language (french).
I’m not a programmer, but I decided the little I know, I see clearly wrong in the formmail code (refer to fields / variables used).
See if you can help me solve:
– Send_mail.php : http://pastebin.com/MMjEnAy0
– Contact.php : http://pastebin.com/dd1Km2Hg
If you need any more information or file, I can post too.
Attached pdf file showing how am receiving emails in my inbox.
Well, the file “send_mail.php” ‘m finding strange line 6 ( $ msg = ” ). Such is not the variable that should be written with any value or different?
Sorry, as I said, I’m not a programmer, I went by instinct and curiosity even. If you can help me, I am sooooo thankful.
Thanks in advance to all.
Paula Viegas
Ready, is now working! Just swapped $ _REQUEST [Message] to $ _REQUEST [message] and problem solved.
Glad to know your issue got fixed. 🙂
Hi there;
This certainly seemed like the best place to post my issue and wondered if you could point me in the right direction.
I have an odd scenario, we run a nginx setup with wordpress, and woocommerce. Now most of our emails are sent out to users (60%), however, it doesn’t matter which plugin, or system that is engaged, about 40% of them fail (they are not sent to junk mail or similar, they just don’t arrive at all).
WordPress’s sendmail function certainly works, and I cannot see a pattern to the issue, so wondered if you had any suggestions as to what I might look out for, as it has totally perplexed me (I’ve even checked blacklist registers etc. which I know it couldn’t really be).
Many thanks for any and all suggestions in advance
Check postfix mail log. You will see why mails are getting rejected there.
You should also debug amavis if you have it running on the server.
We had a similar problem where 80% of emails would be sent and it bugged us for months until we discovered amavis was the culprit. We removed it from the linux server and the problem went away.
Thanks for adding your points. 🙂
We also use amavis (without any issue) and if that is creating any issue, postfix mail.log will have entries about it.
Hi,
I try to send mail from my wordpress site, it seems like both mail() and wp_mail() returns true, but the mails don’t arrive. Tried with a test.php from the same server, and still mail() gets true, but no email arrives to my account. I tried the echo “Test from Postfix” | mail -s “Test1” email from terminal and it works.
I have no idea at this point. Checked the sendmail path, and smtp settings, and they seems to be as supposed.
Do you have some suggestions?
Thanks,
Katalin
I also checked the php.ini configurations for terminal and php with and php -i and the options smtp, sendmail_path, sendmail_from, smtp_port are the same. Why does it work from terminal but not from .php?
try https://rtcamp.com/tutorials/mail/postfix-debugging/