PHP Mail working on one server, not another?


New member
So I have a test environment (Ubuntu) on one server hosted by Linode.
I have a production server (Ubuntu) hosted by SSD-Nodes.

I have an html form that is saved in a mysql db. I also send a copy of
the form to the originator as well as the owner of the website.

It works fine on the test server, so I basically ported the associated code
to the production server.

I am using msmtp for my MTA. Version 1.8.6 on test server and v 1.8.16 on production.

sendmail_path = "/usr/bin/msmtp -C /etc/msmtprc --logfile /var/log/msmtp.log -a gmail -t"

account gmail
tls on
auth on
port 587
password xxxx xxxx xxxx xxxx
(password obfuscated)

I have 2-factor w/App password set for the gmail account.

It works fine on the test server, but somewhere it's failing on the production server?
I have the same config (php and the msmtprc) on both servers.

On the test server, I am using PHP 7.4 and 8.1 on the production, if that matters.
I'm not seeing any error indicators in the mail.err or mail.log files, nor the msmtprc.log.

As this production server is on a provider I have never used before, could they be stopping
gmail from php as I have read is happening with some providers to stop spam?

Any other idea how I can find exactly where this is failing?

Thanks and let me know if you need more info.

So, the /usr/bin/msmtp file owner ship was root:root. On the test server it is www-data:root.
I changed the production server to www-data:root and voila! Does that make sense?