I have a strange issue.
The mails sent by php mail() function are not sent instantaneously.
$Name = "Da Duder"; //senders name
$email = "firstname.lastname@example.org"; //senders e-mail adress
$recipient = "email@example.com"; //recipient
$mail_body = "The text for the mail..."; //mail body
$subject = "Subject for reviever"; //subject
if(mail($recipient, $subject, $mail_body, $header))
This code prints out "Success", however the mail is not sent. It takes a long time before it appears in the inbox. If I restart the sendmail
service sendmail restart
I get all the pending emails.
However if i send email from command line
echo "Subject: test" | sendmail -v firstname.lastname@example.org
the mail is sent out instantaneously.
The contents of the mail log when a mail is sent from php
Nov 23 07:50:53 hostname sendmail: pANCorMN009658: from=apache, size=121, class=0, nrcpts=1, msgid=<201111231250.pANCorMN009658@hostname>, relay=apache@localhost
Nov 23 07:50:53 hostname sendmail: pANCorMN009658: email@example.com, delay=00:00:00, mailer=esmtp, pri=30121, dsn=4.4.3, stat=queued
however the mail queue is empty as displyed by
I get this response for the above command
/var/spool/mqueue is empty
Total requests: 0
All the emails that are pending will be sent at once.
Thanks in advance