我更改路由器后,php sendmail不起作用

php sendmail doesn't work after I changed the router

I'm running a web server that uses PHP sendmail function, which is directly connected to a router and after I replaced my old router to a new router it doesn't work anymore.

Old router - Cisco RV082 - regular firmware New router - Netgear R7000 - DD-WRT v3.0-r30700M kongac

I tried with all ports open and firewalls off but still didn't work. Please help.

Here is the part of the log. Oct 11 is the working one and Oct 13 is not.

/var/log/mail.log

Oct 11 13:58:08 localhost sm-mta[3613]: STARTTLS=client, relay=aspmx.l.google.com., version=TLSv1/SSLv3, verify=FAIL, cipher=ECDHE-RSA-AES128-GCM-SHA256, bits=128/128
Oct 11 13:58:08 localhost sm-mta[3613]: u9BKw7pL003611: to=<joe@ctclogis.com>, ctladdr=<www-data@localhost.localdomain> (33/33), delay=00:00:01, xdelay=00:00:01, maile$
Oct 11 13:58:09 localhost sm-mta[3613]: u9BKw7pL003611: to=<export@ypusa21.com>, ctladdr=<www-data@localhost.localdomain> (33/33), delay=00:00:02, xdelay=00:00:02, mai$
Oct 11 13:58:09 localhost sm-mta[3613]: STARTTLS=client, relay=alt1.aspmx.l.google.com., version=TLSv1/SSLv3, verify=FAIL, cipher=ECDHE-RSA-AES128-GCM-SHA256, bits=128$
Oct 11 13:58:10 localhost sm-mta[3613]: u9BKw7pL003611: to=<joe@ctclogis.com>, ctladdr=<www-data@localhost.localdomain> (33/33), delay=00:00:03, xdelay=00:00:03, maile$

Oct 13 19:20:26 localhost sm-mta[6369]: u9E2KQ20006369: from=<>, size=2122, class=0, nrcpts=1, msgid=<201610140220.u9E2K13e006368@localhost.localdomain>, proto=ESMTP, $
Oct 13 19:20:26 localhost sm-msp-queue[6368]: u9E2K13e006368: to=www-data, delay=00:00:00, xdelay=00:00:00, mailer=relay, pri=31509, relay=[127.0.0.1] [127.0.0.1], dsn$
Oct 13 19:20:26 localhost sm-mta[6370]: u9E2KQ20006369: to=<www-data@localhost.localdomain>, delay=00:00:00, xdelay=00:00:00, mailer=local, pri=32350, dsn=2.0.0, stat=$
Oct 13 19:20:26 localhost sm-msp-queue[6368]: u9DM8URU004818: u9E2K13f006368: sender notify: Warning: could not send message for past 4 hours

Marc B is correct in his comment. This is not the best site for you to be asking this kind of question on. Try the Network Engineering Stack Exchange or something similar.

Now if this is a PHP issue then yes you have posted to the correct site but need to re-word your question to be more compliant. If this is the case have you double checked all the cautions from the PHP manual on the send mail function? From a programming stand point your error could be simply in how you are trying to send the emails. The old router may have just ignored your errors (incorrectly formatted messages) and sent stuff out anyway; from my experience this is not the case because your router usually has nothing to do with this except doing its job of routing or forwarding depending on your setup.

More specifically I'm trying to pick apart your log and I think on the PHP side of things you may have made a few errors.

Oct 13 19:20:26 localhost sm-mta[6369]: u9E2KQ20006369: from=<>, size=2122, class=0, nrcpts=1, msgid=<201610140220.u9E2K13e006368@localhost.localdomain>, proto=ESMTP, $

Your server didn't log a From email address on this line. In your PHP script using the mail function did you forget to set one?

Oct 13 19:20:26 localhost sm-msp-queue[6368]: u9E2K13e006368: to=www-data, delay=00:00:00, xdelay=00:00:00, mailer=relay, pri=31509, relay=[127.0.0.1] [127.0.0.1], dsn$ Oct 13 19:20:26 localhost sm-mta[6370]: u9E2KQ20006369: to=, delay=00:00:00, xdelay=00:00:00, mailer=local, pri=32350, dsn=2.0.0, stat=$

I could be reading this wrong (again this is a programming site) but your mail relay is setup as your localhost. Why? Your old logs from the 11th show you using a google relay.

It seems that either in a PHP script your using to send the emails or your PHP configuration/ server itself has been mis-configured.

I'm sorry I've come to this place all the time and didn't realize it until now lol. BTW, I used the same script for both dates and I have been using it for years so it is not the script error. I will try the website that you recommended. Thanks!

if you can ping remove server from your network, you should be able to send mail also, however verify the configuration from your new router to see if there is something preventing smtp port 25 out

I was able to ping and run the server perfectly fine. I also opened all the ports necessary including SMTP but still didn't work. I ended up switching back to the old router and updated the firmware seems fixed the problem.