Change Sendmail default server


#1

The php mail() function sends mail via example.default.bytemark.uk0.bigv.io. Is it possible to change this to send mail via one of my domain names? Then the emails will be more likely to pass SPF/DKIM tests.

I realise i can send PHP mail via SMTP using PHPMailer, but that requires code updates. It would be nice to change the default, so mail() just works.

Thanks,
Gary


#2

If you are trying to send from Wordpress, there’s a nice plugin: WP Mail SMTP by WPForms. If you’re talking about all php mail() calls globally, then I don’t know, I’m afraid.


#3

I think the easiest hack would be to intercept the call to exim in the apache conf, setting the smtp reverse-path – and From header if it hasn’t already been set via mail()'s $additional_headers.

Something like…

php_admin_value sendmail_path "/usr/sbin/sendmail -t -i -f no-reply@my-brilliant-site.example.com -F 'Brilliant WebAdmin'"

… which could go in selected sites at /etc/apache2/sites-available/*.conf or globally via:

/etc/symbiosis/apache.d/ssl.template.erb
/etc/symbiosis/apache.d/non_ssl.template.erb

… and a sysmbiosis rebuild.