I am having trouble getting support to do any useful testing or explanation.
My issue is I am not receiving emails when sending from the web server using PHP mail() function.
Support ran a test using a 3,000 line script with all sorts of config for which I received the email and they say that is a sufficient test to show that email works.
This is ridiculous since you should just be able to issue a short php mail() command and have email sent. I do not receive anything using the below script.
I believe this to be a server config issue but support will not even look at it.
$to = 'email@example.com';
$subject = 'the subject';
$message = 'hello';
$headers = 'From: firstname.lastname@example.org' . "\r\n" .
'Reply-To: email@example.com' . "\r\n" .
'X-Mailer: PHP/' . phpversion();
mail($to, $subject, $message, $headers);
What can I do to check. Is there anything I can do in the php.ini file to set this up?
Is it a server config error?
Solved! Go to Solution.
Hello qwertyjjj, I hope you are well. If you're using SMTP for sending mail then please ensure the correct relay server and port are configured in your settings, which would be relay-hosting.secureserver.net using port 25.I think what might be needed is to add the To field to the headers.
$headers .= "To: $email\r\n";
Also, on many servers, the From field has to contain an email address that actually exists in the account. I think this depends on what kind of hosting plan you have but it couldn't hurt to define one of your free accounts as firstname.lastname@example.org and set it's mailbox size to 1MB.
Hi @qwertyjjj ,
I've had similar problems, and they are not always easy to solve. One thing I have done is contact support and have them walk me through getting the fully qualified name of the relay server and using it in the config. This is not a perfect solution, but just a work around. Depending on the why the auto config for the relay is not working, this may or may not work.
Also, email servers can be quite particular on what is ACTUALLY sent. Make sure that all of your mail server records are correct. You can check some of this with the toolbox at https://mxtoolbox.com/.
Hope this helps,