PHP mail() function not working – looks like exim is rejecting for some reason

emailexim

I have tested the script on another server and it works fine.

When I check exim logs there are lots of rows like this,

User 0 set for local_delivery transport is on the never_users list

lots like this

routing defer (-51): retry time not reached

and even some like this

R=lookuphost T=remote_smtp defer (-44): SMTP error from remote mail server after RCPT TO:

I am pretty stumped to be honest.

All mail is fine when sending from webmail/outlook etc! I have full SSH and root access as this is a VPS. Any help would be much appreciated

Best Answer

Exim is trying to deliver the mail to a remote SMTP host and is failing. This is what the:

R=lookuphost T=remote_smtp defer (-44): SMTP error from remote mail server after RCPT TO:

lines mean. It queues these mails up for retry, and skips through the mailq to see if it should attempt to redeliver any of these mails. It won't attempt this straight away, a predetermined timeout has to be reached. This causes:

routing defer (-51): retry time not reached

Finally, when the max redelivery attempts is reached without success, it tries to deliver a mail to the postmaster (which by default is configured as root). However, the default exim configuration is to never deliver to root, so you get:

**User 0 set for local_delivery transport is on the never_users lis**t

There's two problems here:

Firstly: exim can't deliver to this particular SMTP server. Either the destination SMTP server is broken, or Exim cannot deliver to any SMTP servers. Does exim deliver mail to address on other domains? You can test this on the command line with:

/path/to/exim -v 'email@example.com'
message here
^D ( control D )

Secondly, you don't have a valid way for exim to report failures back to you. Configure your /etc/aliases file to make sure that the postmaster and other accounts are properly aliased to a real address.

Related Topic