Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Sendmail issue: successfully sent but never arrives

I'm trying to send mail via the PHP mail() function which as far as I have understood uses sendmail to deliver the goods. Now my problem is that mail() returns true but there is not even a trace of the mail in my mailbox (yea i checked spam too).

So i tried to send some mail manually from the terminal but the problem persists. sendmail does not give me an error, except from a unable to determine domain error which i fixed by adding the domain for my dev-machine to /etc/hosts and related it to 127.0.0.1.

andreas@Andreas-PC-Ubuntu:~$ sendmail [email protected]
Test
.
andreas@Andreas-PC-Ubuntu:~$

As well as giving no error, sendmail logs that the mail was sent successfully in /var/log/mail.log:

Apr  7 01:16:21 Andreas-PC-Ubuntu sendmail[11759]: q36NGIfD011759: from=andreas, size=5, class=0, nrcpts=1, msgid=<[email protected]>, relay=andreas@localhost
Apr  7 01:16:21 Andreas-PC-Ubuntu sm-mta[11760]: q36NGL1J011760: from=<[email protected]>, size=299, class=0, nrcpts=1, msgid=<[email protected]>, proto=ESMTP, daemon=MTA-v4, relay=ip6-localhost [127.0.0.1]
Apr  7 01:16:21 Andreas-PC-Ubuntu sendmail[11759]: q36NGIfD011759: [email protected], ctladdr=andreas (1000/1000), delay=00:00:03, xdelay=00:00:00, mailer=relay, pri=30005, relay=[127.0.0.1] [127.0.0.1], dsn=2.0.0, stat=Sent (q36NGL1J011760 Message accepted for delivery)

So yea, any suggestions?

like image 565
Andreas Hagen Avatar asked Apr 06 '12 23:04

Andreas Hagen


2 Answers

Are you sure the recipient SMTP server isn't dropping (or at least greylisting) your mail? It's very common for mail servers to treat messages not coming from a recognized MX server as being spammy.

Is sendmail configured to use an SMTP relay/smarthost? If not, what happens if you configure it to use your ISP's, employer's, or other hosting provider's server?

like image 190
Conrad Shultz Avatar answered Oct 31 '22 23:10

Conrad Shultz


have you set up the configuration in your php.ini file?

When i setup php on my own server (I was running IIS on server 2003, with Exchange for emails), I had to edit the php.ini file to configure the Mail function.

Just had to uncomment andspecify my mail server for the SMTP part.

Edit

[mail function]
; For Win32 only.
; http://php.net/smtp
SMTP = #mymailserver#
; http://php.net/smtp-port
smtp_port = 25

You will probably have to do the same, or similar, depending on your web server environment

like image 22
OACDesigns Avatar answered Nov 01 '22 00:11

OACDesigns