I'm trying to setup a server so that I can send email from PHP using the mail() function. I tried running a script that I know works but never got the email. Here is the log file:
Sep 1 13:58:27 server1 postfix/master[5318]: daemon started -- version 2.5.5, configuration /etc/postfix
Sep 1 13:59:21 server1 dovecot: Dovecot v1.0.15 starting up
Sep 1 13:59:21 server1 dovecot: Generating Diffie-Hellman parameters for the first time. This may take a while..
Sep 1 13:59:22 server1 dovecot: Killed with signal 15
Sep 1 13:59:22 server1 dovecot: Dovecot v1.0.15 starting up
Sep 1 13:59:22 server1 dovecot: Generating Diffie-Hellman parameters for the first time. This may take a while..
Sep 1 13:59:22 server1 dovecot: Killed with signal 15
Sep 1 13:59:22 server1 dovecot: Dovecot v1.0.15 starting up
Sep 1 13:59:22 server1 dovecot: Generating Diffie-Hellman parameters for the first time. This may take a while..
Sep 1 14:12:37 server1 postfix/master[5318]: terminating on signal 15
Sep 1 14:12:37 server1 postfix/master[5998]: daemon started -- version 2.5.5, configuration /etc/postfix
Sep 1 14:12:41 server1 dovecot: Killed with signal 15
Sep 1 14:12:41 server1 dovecot: Dovecot v1.0.15 starting up
Sep 1 14:21:16 server1 postfix/master[5998]: terminating on signal 15
Sep 1 14:21:18 server1 dovecot: Killed with signal 15
Sep 1 14:22:14 server1 postfix/master[2031]: daemon started -- version 2.5.5, configuration /etc/postfix
Sep 1 14:24:31 server1 postfix/master[2033]: daemon started -- version 2.5.5, configuration /etc/postfix
Sep 1 14:25:22 server1 dovecot: Dovecot v1.0.15 starting up
Sep 1 14:39:44 server1 postfix/master[2033]: terminating on signal 15
Sep 1 14:39:48 server1 dovecot: Killed with signal 15
Sep 1 14:40:43 server1 postfix/master[2033]: daemon started -- version 2.5.5, configuration /etc/postfix
Sep 1 14:40:44 server1 dovecot: Dovecot v1.0.15 starting up
Sep 1 14:43:28 server1 postfix/pickup[2042]: 5FAEE256327: uid=33 from=<www-data>
Sep 1 14:43:28 server1 postfix/cleanup[2214]: 5FAEE256327: message-id=<[email protected]>
Sep 1 14:43:28 server1 postfix/qmgr[2044]: 5FAEE256327: from=<[email protected]>, size=418, nrcpt=1 (queue active)
Sep 1 14:43:28 server1 postfix/smtp[2216]: connect to gmail-smtp-in.l.google.com[209.85.210.23]:25: No route to host
Sep 1 14:43:28 server1 postfix/smtp[2216]: connect to alt1.gmail-smtp-in.l.google.com[209.85.212.8]:25: No route to host
Sep 1 14:43:28 server1 postfix/smtp[2216]: connect to alt2.gmail-smtp-in.l.google.com[209.85.219.43]:25: No route to host
Sep 1 14:43:28 server1 postfix/smtp[2216]: connect to alt3.gmail-smtp-in.l.google.com[209.85.129.114]:25: No route to host
Sep 1 14:43:28 server1 postfix/smtp[2216]: connect to alt4.gmail-smtp-in.l.google.com[209.85.222.4]:25: No route to host
Sep 1 14:43:28 server1 postfix/smtp[2216]: 5FAEE256327: to=<[email protected]>, relay=none, delay=0.26, delays=0.11/0.04/0.11/0, dsn=4.4.1, status=deferred (connect to alt4.gmail-smtp-in.l.google.com[209.85.222.4]:25: No route to host)
I'm guessing it has something to do with the "No route to host"... any ideas?
You need to resolve the "No route to host" issue before you can get e-mail through. You can test it by running the following command from the server:
It should look something like:
Where I typed "quit" to exit. If you don't get the "220" line, your server has problems connecting to the remote mail server.
If that is the case, I'd guess it's either a routing problem (missing default route? Check "netstat -nr" output), or a firewalling issue (check "iptables-save | less" output).
Sean
FYI: Google Mail was down earlier today. You didn't specify if this was causing trouble with other hosts.
If it's still causing you trouble, then perhaps your network administrator is blocking outgoing port 25. Some ISPs do this to stop spam. You can contact your network administrator for details about that.
those ip's are reachable from your server; I guess you don't have connection to them, though your dns resolves mx for gmail
try telnetting to port 25 to at least one of those ip addresses
please check your routing and firewall rules
On your sever you can try this command : sendmail [email protected] Subject: test CTRL +D
then cat /var/log/mail.info and check if you mail is sent. If you have any issue by sending an email from terminal then that won't work with php.
Tell us what the command gives you