PHP mail () function does not deliver mail

I have a little problem. I use a working script (runs on my test account - shared server) to send mail through PHP using the mail () function.

I just got a dedicated server and I was not able to get this feature to work. I spent the last 10 or so hours reading various documents on BIND (for writing SPF), dovecot, sendmail and postfix, trying to use different things to make this work.

Clearly what I am missing.

So, we know that the PHP code is working fine. All headers are all right. We know this as a direct copy of my test account. Therefore, the problem should occur somewhere in the server configuration. The path to sendmail is correct, and sendmail (apparently) is working fine. I configured the script to deliver "Sent" or "Error" based on the logical result from the PHP mail () function. I.e:

if(mail($blah,$blah,$blah,$blah,$blah)) { echo "Sent"; } else { echo "Error";} 

And the result ALWAYS appears as "Sent", but the letter does not come. Maybe someone tells me what to check, since I'm completely new to this (24 hours or so!).

Thanks in advance.

Ryan

+2
source share
2 answers

Have you tried mailq command to find out if there are any errors? Here's a more detailed answer to a similar question on ServerFault .

0
source

Is an SMTP server installed? The php mail function will not work unless you install it. For example, in linux you can set the postfix. Under the windows, MS Exchange is an example.

0
source

Source: https://habr.com/ru/post/1482450/


All Articles