javascript - Is it possible to get PHPmailer to send the mail after the page loads? -
i have script sends @ least 1 email using phpmailer, potentially 5. action of sending mail delays page loading around 2-3 seconds. acceptable, doubles , triples each email sent. placing code after page html doesn't make difference. know php apparently "single thread" application, surely there's smarter way of doing this? there fancy javascript applet silently load page in background, or there neater way?
tips welcomed.
i write separate script accepts necessary data command line arguments , launch script background process main script can exit without waiting finish. so:
exec("nohup /usr/bin/php mailerscript.php $param1 $param2 > /dev/null &");
inside mailerscript.php, can access $param1
, $param2
$argv[1]
, $argv[2]
. make sure mailerscript.php executable webserver process , specify full path in exec.
Comments
Post a Comment