[BlueOnyx:19524] Re: Sendmail php mail function slow
Simone Capra
capra at erweb.it
Wed Apr 27 08:12:18 -05 2016
Hi Michael!
thank you for your reply.
The issue seems to be network related, expecially bandwith related.
I have modified the /usr/sausalito/sbin/phpsendmail to fork and not to
wait the email being sent...
Here it is:
my $pid = fork();
if (defined $pid && $pid == 0) {
# child
# Log the activity into /var/log/maillog with all the info we have
gathered:
system("/usr/bin/logger -p mail.info sendmail-wrapper-php:
site=$HTTP_HOST, client=$REMOTE_ADDR, script=$PWD$SCRIPT_NAME, uid=$UID,
user=$OWNER");
# Actually send the email by passing it to Sendmail:
system("/usr/sbin/sendmail -t -i $options");
exit 0;
}
Regards
Simone Capra
Problemi con le configurazioni di posta elettronica?
http://assistenza.erweb.it/
http://www.dnsqueries.com
Il 26/04/2016 19.50, Michael Stauber ha scritto:
> Hi Simone,
>
>> i am experiencing a problem with all my boxes. When a php script calls
>> the mail() function, it actually takes more than 30 seconds to send out
>> the email (and the page loading waits that time).
>>
>> i have measured it with this script
>> <?php
>>
>> echo ini_get('sendmail_path').'<br />'.PHP_EOL;
>> echo date('H:i:s').'<br />'.PHP_EOL;
>> mail('capra at erweb.it','Hi','How are you?');
>> echo date('H:i:s').'<br />'.PHP_EOL;
> Could you please try out this command?
>
> time /usr/sbin/sendmail capra at erweb.it </root/.bashrc
>
> That will send the file /root/.bashrc to your own email address and
> shows you how long it took to complete that command. The response would
> be something like this:
>
> real 0m0.731s
> user 0m0.023s
> sys 0m0.016s
>
> See if that's considerably slower, faster or similar to what you see
> when you email from PHP.
>
> If it's equally slow, then the slowdown affects all email related
> transactions. Which would point to a general problem. Such as your
> /etc/resolv.conf containing DNS name servers that no longer work. Email
> depends heavily on DNS and that could cause this problem.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.blueonyx.it/pipermail/blueonyx/attachments/20160427/af724f73/attachment.html>
More information about the Blueonyx
mailing list