Mail sent twice but only to Hotmail
Posted: Tue May 12, 2009 5:51 am
Hi
I've just started trying out Swift Mailer which is perfect for my project but I have hit a problem with my first test.
I took a chunk of code out of the manual (Using the send() Method - http://swiftmailer.org/docs/send-method)
The only thing I added were my details and an addPart (makes no difference if I remove this).
I have a blueyonder.co.uk email account and a Hotmail account so I used both for the test. When I run the test, the message at the bottom of the code reported 2 messages sent. But 3 arrive. The blueyonder one gets there fine - one email. The hotmail account receives two.
I guess it'd make more sense if both accounts received it twice. As I've used the manual code intact it's hard to see what I've done wrong. Have I misunderstood something?
I'm using Php 5.2.9 set with an .htaccess file which is working (ran phpinfo() to check).
Php 4.4.9 is used elsewhere on the site but this test is in a separate folder along with the library and the .htaccess file.
Any help appreciated
David
I've just started trying out Swift Mailer which is perfect for my project but I have hit a problem with my first test.
I took a chunk of code out of the manual (Using the send() Method - http://swiftmailer.org/docs/send-method)
The only thing I added were my details and an addPart (makes no difference if I remove this).
I have a blueyonder.co.uk email account and a Hotmail account so I used both for the test. When I run the test, the message at the bottom of the code reported 2 messages sent. But 3 arrive. The blueyonder one gets there fine - one email. The hotmail account receives two.
Code: Select all
<?php
require_once 'lib/swift_required.php';
//Create the Transport
$transport = Swift_SmtpTransport::newInstance('mail.********.com', 25)
->setUsername('info@********.com')
->setPassword('********')
;
//Create the Mailer using your created Transport
$mailer = Swift_Mailer::newInstance($transport);
//Create a message
$message = Swift_Message::newInstance('Wonderful Subject')
->setFrom(array('info@******.com' => '******'))
->setTo(array('********@hotmail.com', '********@blueyonder.co.uk' => '********'))
->setBody('Here is the message itself')
//And optionally an html body
->addPart('<strong>Here is the message itself</strong>', 'text/html')
;
//Send the message
$numSent = $mailer->send($message);
printf("Sent %d messages\n", $numSent);
/* Note that often that only the boolean equivalent of the return value is of concern (zero indicates FALSE)*/
if ($mailer->send($message))
{
echo "Sent\n";
}
else
{
echo "Failed\n";
}
?>
I'm using Php 5.2.9 set with an .htaccess file which is working (ran phpinfo() to check).
Php 4.4.9 is used elsewhere on the site but this test is in a separate folder along with the library and the .htaccess file.
Any help appreciated
David