running swiftmailer in the background (general help)
Posted: Sun Apr 29, 2007 2:10 pm
Jcart | Please use
1.) Does know what's wrong with my php in general?
2.) What's a configuration I can use to get the page to redirect first and then run the call in the background?
My dev setup is MAMP, PHP5 and Swiftmailer 3.1.3.
Thanks.
Jcart | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
Hi,
I have set up Swiftmailer to run as a function in an include file called from a webpage. It is the basic Swiftmailer setup with an AntiFlood plugin throwing mail out every 60 seconds. My desired result is to call the mailer function and then immediately redirect the page so that the call runs in the background. I have tried a couple of different configurations and none of them seem to work (the page doesn't redirect until after 60 seconds when sending only 1 email):Code: Select all
if($_POST['action'] == "mass_mail") {
$someArgs = "blah blah blah";
ignore_user_abort(TRUE);
header('Location: index.php');
massMailThroughSwift($someArgs);
}Code: Select all
if($_POST['action'] == "mass_mail") {
$someArgs = "blah blah blah";
ignore_user_abort(TRUE);
header('Location: index.php');
echo "Trying to force server to output...";
flush();
ob_flush();
massMailThroughSwift($someArgs);
}Code: Select all
if($_POST['action'] == "mass_mail") {
$someArgs = "blah blah blah";
ignore_user_abort(TRUE);
header('Location: index.php');
register_shutdown_function("massMailThroughSwift",$someArgs);
exit();
}2.) What's a configuration I can use to get the page to redirect first and then run the call in the background?
My dev setup is MAMP, PHP5 and Swiftmailer 3.1.3.
Thanks.
Jcart | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]