Change Sendmail default server


The php mail() function sends mail via 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.



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.


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 -F 'Brilliant WebAdmin'"

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


… and a sysmbiosis rebuild.