Re: mail() takes too much time

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



You might want to consider a few things:

Queueing your email in a database table and sending it out in a
separate process.

or

Finding a mail daemon that will queue quickly for you and not send
directly on adding to the queue.

I use the first of the two options and it works quite well for us.

Gavin

On 9/2/07, shiplu <shiplu.net@xxxxxxxxx> wrote:
> Hello everybody,
>
> I am maintaining a social network site.
> there each user can send other mail.
> these mails are not real mail rather message entry to database.
> I added a new feature so that every message is sent to me (admin/webmaster)
> via email (real e-mail).
> I used mail function.
> THis is a simple mail function. all it does sends mail with the message as
> the mail body to my address.
> Thats it. no extra complexity.
> But the problem is I got the mail very late. after 4-6 hours. That is  huge
> time difference.
> I shouldn't take more than 3-5 mins.
> Do you know the reason?
> my mail code is here,
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> $headers  = "MIME-Version: 1.0\r\n";
> $headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
> list($myname,$mydomain)=preg_split("/\@/",$myemail,2);
> $headers .= "From: $myname <$myemail>\r\n";
> mail("me@xxxxxxxxxx", "message from XXX to YYY", $message_content,
> $headers);
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
> --
> shout at http://shiplu.awardspace.com/
>
> Available for Hire/Contract/Full Time
>

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux