email sent twice
Posted: Thu Sep 27, 2007 3:25 pm
Hi!
I'm using SwiftMailer 3.3.1 and PHP4. I use it to send email for a home-made mailing-list. My problem is that every message is send twice! The website use a homemade too content management, and I use SwiftMailer in it. If I use SwiftMailer outside it, there is no problem. Please help! I'm adding part of the code and the log. Thanks.
Here's the log:
options0
before send
after send 1
Success ++ Log level changed to 4 ++ Trying to connect... ++ Trying to connect to SMTP server at 'localhost:25 << 220 box3.rapidenet.ca ESMTP Exim 4.60 Thu, 27 Sep 2007 13:04:30 -0400 >> EHLO [72.10.166.34] << 250-box3.rapidenet.ca Hello localhost [127.0.0.1] 250-SIZE 20971520 250-PIPELINING 250-AUTH PLAIN LOGIN 250-STARTTLS 250 HELP ++ SMTP extension 'SIZE' reported with attributes [20971520]. ++ SMTP extension 'PIPELINING' reported with attributes []. ++ SMTP extension 'AUTH' reported with attributes [PLAIN, LOGIN]. ++ SMTP extension 'STARTTLS' reported with attributes []. ++ SMTP extension 'HELP' reported with attributes []. >> MAIL FROM: << 250 OK >> RCPT TO: << 250 Accepted >> DATA << 354 Enter message, ending with "." on a line by itself >> >> . << 250 OK id=1Iawms-0008WN-5L ++ Message sent to 1/1 recipients ++ Log level changed to 4 ++ Trying to connect... ++ Trying to connect to SMTP server at 'localhost:25 << 220 box3.rapidenet.ca ESMTP Exim 4.60 Thu, 27 Sep 2007 13:04:30 -0400 >> EHLO [72.10.166.34] << 250-box3.rapidenet.ca Hello localhost [127.0.0.1] 250-SIZE 20971520 250-PIPELINING 250-AUTH PLAIN LOGIN 250-STARTTLS 250 HELP ++ SMTP extension 'SIZE' reported with attributes [20971520]. ++ SMTP extension 'PIPELINING' reported with attributes []. ++ SMTP extension 'AUTH' reported with attributes [PLAIN, LOGIN]. ++ SMTP extension 'STARTTLS' reported with attributes []. ++ SMTP extension 'HELP' reported with attributes []. >> MAIL FROM: << 250 OK >> RCPT TO: << 250 Accepted >> DATA << 354 Enter message, ending with "." on a line by itself >> >> . << 250 OK id=1Iawms-000051-M2 ++ Message sent to 1/1 recipients
I'm using SwiftMailer 3.3.1 and PHP4. I use it to send email for a home-made mailing-list. My problem is that every message is send twice! The website use a homemade too content management, and I use SwiftMailer in it. If I use SwiftMailer outside it, there is no problem. Please help! I'm adding part of the code and the log. Thanks.
Code: Select all
$log =& Swift_LogContainer::getLog();
$log->setLogLevel(4);
/* On ajoute au message un fichier s'il y en a eu un de sélectionné */
if ($_POST['attachment'] != "none")
{
$message =& new Swift_Message($subject);
$message->headers->set("Reply-To",$reply);
$message_text_part = new Swift_Message_Part($text);
if ($_POST['html_email'] == "on")
$message_text_part->setContentType("text/html");
$message->attach($message_text_part);
$fileattname = $_POST['attachment'];
$fileatt = "../data/" . $this->liste['attach']['dir'] . "/" . $fileattname;
$mimetype = new mimetype();
$fileattype = $mimetype->getType($fileatt);
$message->attach(new Swift_Message_Attachment(new Swift_File("../data/" . $this->liste['attach']['dir'] . "/" . $fileattname), $fileattname, $fileattype));
}
else
{
$message =& new Swift_Message($subject,$text);
$message->headers->set("Reply-To",$reply);
if ($_POST['html_email'] == "on")
$message->setContentType("text/html");
}
// Connection au serveur SMTP
$swift =& new Swift(new Swift_Connection_SMTP("localhost"));
echo "options" . $swift->getOptions() . "<br/>\n";
// On envoit le message
echo "before send<br/>\n";
$message_test =& new Swift_Message("un autre putain de test","on vas-tu le régler ce prob???");
$sent = $swift->send($message_test, "me@me.me", $from);
echo "after send " . $sent . "<br/>\n";
if ($sent > 0)
{echo "Success "; echo $log->dump(true);}
else
echo "Failure ";options0
before send
after send 1
Success ++ Log level changed to 4 ++ Trying to connect... ++ Trying to connect to SMTP server at 'localhost:25 << 220 box3.rapidenet.ca ESMTP Exim 4.60 Thu, 27 Sep 2007 13:04:30 -0400 >> EHLO [72.10.166.34] << 250-box3.rapidenet.ca Hello localhost [127.0.0.1] 250-SIZE 20971520 250-PIPELINING 250-AUTH PLAIN LOGIN 250-STARTTLS 250 HELP ++ SMTP extension 'SIZE' reported with attributes [20971520]. ++ SMTP extension 'PIPELINING' reported with attributes []. ++ SMTP extension 'AUTH' reported with attributes [PLAIN, LOGIN]. ++ SMTP extension 'STARTTLS' reported with attributes []. ++ SMTP extension 'HELP' reported with attributes []. >> MAIL FROM: << 250 OK >> RCPT TO: << 250 Accepted >> DATA << 354 Enter message, ending with "." on a line by itself >> >> . << 250 OK id=1Iawms-0008WN-5L ++ Message sent to 1/1 recipients ++ Log level changed to 4 ++ Trying to connect... ++ Trying to connect to SMTP server at 'localhost:25 << 220 box3.rapidenet.ca ESMTP Exim 4.60 Thu, 27 Sep 2007 13:04:30 -0400 >> EHLO [72.10.166.34] << 250-box3.rapidenet.ca Hello localhost [127.0.0.1] 250-SIZE 20971520 250-PIPELINING 250-AUTH PLAIN LOGIN 250-STARTTLS 250 HELP ++ SMTP extension 'SIZE' reported with attributes [20971520]. ++ SMTP extension 'PIPELINING' reported with attributes []. ++ SMTP extension 'AUTH' reported with attributes [PLAIN, LOGIN]. ++ SMTP extension 'STARTTLS' reported with attributes []. ++ SMTP extension 'HELP' reported with attributes []. >> MAIL FROM: << 250 OK >> RCPT TO: << 250 Accepted >> DATA << 354 Enter message, ending with "." on a line by itself >> >> . << 250 OK id=1Iawms-000051-M2 ++ Message sent to 1/1 recipients