Multiple Emails Being Sent

Swift Mailer is a fantastic library for sending email with php. Discuss this library or ask any questions about it here.

Moderators: Chris Corbyn, General Moderators

Post Reply
allthenations
Forum Newbie
Posts: 2
Joined: Thu Mar 06, 2008 5:39 pm

Multiple Emails Being Sent

Post by allthenations »

I just installed the latest version of Swift (PHP5) and I did the smoke test with SMTP, along with my own coded tests, and I keep receiving multiple test emails approximately every 10 minutes. It's as if the script is still running.

Any ideas?
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Re: Multiple Emails Being Sent

Post by Chris Corbyn »

What were your own tests? Can we see the code?
allthenations
Forum Newbie
Posts: 2
Joined: Thu Mar 06, 2008 5:39 pm

Re: Multiple Emails Being Sent

Post by allthenations »

//Load in the files we'll need
require_once "lib/Swift.php";
require_once "lib/Swift/Connection/SMTP.php";

//Start Swift
$smtp =& new Swift_Connection_SMTP("mail.allthenations.org", 25);
$smtp->setUsername("blog@allthenations.org");
$smtp->setpassword("password");

$swift =& new Swift($smtp);

$body = "This is the test message.";

//Create the message
$message =& new Swift_Message("My subject", "$body");

$recipients =& new Swift_RecipientList();
$recipients->addTo("allthenations@gmail.com", "Chris Davis"); //We can give a name along with the address
$recipients->addTo("chrisphone@allthenations.org");

//Now check if Swift actually sends it
if ($swift->send($message, $recipients, "blog@allthenations.org")) echo "Sent";

else echo "Failed";
Post Reply