Delay in sending mail from php
I have a strange issue.
The mails sent by php mail() function are not sent instantaneously.
However if i send email from command line
The contents of the mail log when a mail is sent from php
All the emails that are pending will be sent at once.
Thanks in advance
Do you have the same issue with all destination MTA or only one of them? (what about a test on a yahoo or google email address?)
Did you check the log the the MTA that is is charge of receiving the mail? (if you own it)
Make sure that the time are sync via NTP and compare the date/time of both logs.
Maybe it's the remote MTA which delaying the delivery.
When a program submits a message to the system, the message goes into /var/spool/clientmqueue. At regular intervals, the Queue runner moves the messages from clientmqueue into mqueue. This is probably what's causing your delay. You don't see it when you run sendmail -v because sendmail from the command line will submit messages directly to /var/spool/mqueue.
You can configure the frequency with which the Queue runner processes clientmqueue by editing /etc/sysconfig/sendmail.
You probably have
Set this to something a bit shorter if you want the Queue runner to process messages more quickly. But, be aware that if your server processes LOTS of messages then setting the interval to a "too short" value will make things worse. It is possible to set it short enough (1m, 5m) so that one Queue runner has not yet finished processing clientmqueue when another one kicks off. This can use up more system resources and actually slow things down overall. So set it to an interval that's acceptably short, yet which will not cause multiple Queue runners to process clientmqueue at the same time.
Thanks a lot.
we had QUEUE=1h in /etc/sysconfig/sendmail
I changed it to 1m and the issue is resolved.
However, we have another server, which has QUEUE=1h. But still it sends out emails instantaneously from php.
Any ideas on this? How could this happen?
1m is almost certainly too fast.
You are going to end up with problems when you get a dozen or so messages in clientmqueue and the Queue runner cannot process them in under a minute.
Regarding why one server sends emails instantaneously and the other does not, I'd compare the /etc/sysconfig/sendmail files of the two servers and if you find no differences there, compare /etc/mail/sendmail.cf between the two servers.
|All times are GMT -5. The time now is 11:26 AM.|