Problem sending two mails with attachments
Posted: Mon Apr 07, 2008 4:26 am
Hi,
As the title says, I am trying to send two mail messages with attachments, but only the first one gets to its destination.
Also, I am getting no errors for it, just an annoying blank page.
Here is my code:
It looks kind of lame that I'm using two swift objects to send the messages, but that was just my first approach to get rid of this problem (which obviously didn't work).
Thanks,
Ygor
As the title says, I am trying to send two mail messages with attachments, but only the first one gets to its destination.
Also, I am getting no errors for it, just an annoying blank page.
Here is my code:
Code: Select all
$connectionobject = new Swift_Connection_SMTP(xxxxx);
$connectionobject->setUsername(xxxxx);
$connectionobject->setPassword(xxxxx);
$connectionobject->attachAuthenticator(new Swift_Authenticator_LOGIN());
$swift = new Swift($connectionobject);
$message = new Swift_Message($subject);
$message->setReturnPath(xxxxx);
$message->attach(new Swift_Message_Part($body,"text/html"));
$message->attach(new Swift_Message_Attachment(new Swift_File($_FILES['factura']['tmp_name']), $_FILES['factura']['name']));
$swift->send($message, $client_email,$our_mail);
$swift->disconnect();
$connectionobject2 = new Swift_Connection_SMTP(xxxxx);
$connectionobject2->setUsername(xxxxx);
$connectionobject2->setPassword(xxxxx);
$connectionobject2->attachAuthenticator(new Swift_Authenticator_LOGIN());
$swift2 = new Swift($connectionobject2);
$message2 = new Swift_Message($subject2);
$message2->setReturnPath(xxxxx);
$message2->attach(new Swift_Message_Part($body2,"text/html"));
$message2->attach(new Swift_Message_Attachment(new Swift_File($_FILES['factura3']['tmp_name']), $_FILES['factura3']['name']));
$swift2->send($message2,$ygor_mail,$our_mail);
$swift2->disconnect();Thanks,
Ygor