possible to return log ?

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
webstyler
Forum Commoner
Posts: 85
Joined: Sat Feb 14, 2004 2:16 am

possible to return log ?

Post by webstyler »

Hi, really a wonderfull script :D

When make batch sent is possible to have in return the log of email sent and not ?

And what's happen if a batch sent is stopped for any trouble ?

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

Post by Chris Corbyn »

Batch won't stop for trouble. Addresses in the batch may fail but Swift just notes these failures down and carries on.

Check the contents of $swift->getFailedRecipients() *after* sending. If it's empty the SMTP server accepted all addresses for delivery. If it's got addresses in it those addresses failed.

Swift can only see what the SMTP server tells it however. Just because the SMTP server accepts the message for delivery does not guarantee it will reach the intended recipient.
User avatar
anjanesh
DevNet Resident
Posts: 1679
Joined: Sat Dec 06, 2003 9:52 pm
Location: Mumbai, India

Post by anjanesh »

The last line of a mai-sending-code using swiftmailer (php5 version) is

Code: Select all

$swift->batchSend($message, $recipients, new Swift_Address("mail@domain.com", "My Name"));
How do I get any sort of log from this ?
How do I know which got sent and which failed ? Anyway to pipe log to a file ?
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Post by Chris Corbyn »

Code: Select all

$swift = new Swift( ... );
$swift->log->enable();

$swift->batchSend( ... );

var_dump($swift->log->getFailedRecipients());
Post Reply