Email address doesn't receive emails sent using mail()

Hi,

Not sure if this is a PHP issue but here is my problem:

I have a PHP application, coded by myself and distributed for use. A user installed this on a VPS server. In my application, there is a contact form that uses mail() function to send the contact message to the specified email address of that user. That email address is set in a settings file. When I test this contact form with my email (...@yahoo.com), another email (...@live.com) and one other that uses my domain (...@mydomain.com) it works fine, the contact message is sent. However, when the user puts his email which is (...@hisdomain.com), the form doesn’t send the message. No errors. What could be the reason for such a behavior? I am guessing that it is something to do with his email but no idea.

Thanks for any ideas.

The problem could be in the sendmail configuration of VPS server. Check mail server’s log files to see what’s happening there.

Thanks, either there is no mailserver log file on the server or I couldn’t find it…

Generally, mail() function in PHP is not very reliable and is not a good idea when message delivery must always work. Use a library for sending mail - either Swiftmailer or PHPMailer - and set it up to send messages via an SMTP account set up by the user, preferrably on the same server. Swiftmailer can also send messages without specifying SMTP - it is slightly better than plain mail(). You could set up your library to use Swiftmailer without SMTP by default and strongly encourage users to create their own SMTP accounts and configure your application to use them. PHPMailer may have a similar feature but I don’t remember now.

mail() has all kinds of issues, depends a lot on server configuration and you will always find someone for whom it is unreliable.

Hi please check secure email.php page coding and check contact page coding. I think coding mistake between the pages.