You are here: Re: Sending Lots of Emails in the BACKGROUND? « PHP Programming Language « IT news, forums, messages
Re: Sending Lots of Emails in the BACKGROUND?

Posted by Daniel Tryba on 11/11/59 11:19

Good Man <heyho@letsgo.com> wrote:
[snip]
> exec("my php script that emails people");
> echo "complete!";
>
> ...does not echo "complete!" until the thousands of people have all had
> their info passed to the mail server (a long time).
[snip]
> Does anyone have any thoughts as to how I can send the emails without
> preventing the administrator from doing other tasks until the script has
> finished executing?
[snip]

You need to fork and background that process (see
http://nl2.php.net/manual/en/function.pcntl-fork.php or simply append a
'&' to the program/script you exec (making sure _any_ output is
redirected to eg /dev/null)).

Better yet would be to create a que mechanism, add email and body to a
database and have a script periodically check if there are entries to be
sent. That way there is only 1 process trying to spam^Wsend email you
have to look after.

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация