PHP Developers Network

Problem with sending some mails at once
Page 1 of 1

Author:  alexd1991 [ Wed Jan 09, 2013 4:29 am ]
Post subject:  Problem with sending some mails at once


I'm want to use swift mailer to send some mails at the same time.
But it doesent work :(

Syntax: [ Download ] [ Hide ]
foreach($id as $key => $value){
    if($value[1]=="on" && $value[2] !=""){
        $message = Swift_Message::newInstance($betreff)
            ->setFrom(array($row['email'] => $_SESSION['vname']." ".$_SESSION['nname']))
        $transport = Swift_MailTransport::newInstance();
        $mailer = Swift_Mailer::newInstance($transport);
            echo "OK";
            echo "ERROR";

The email adresses are in $id, exactly in $value[2].

Im always getting this error below:
Syntax: [ Download ] [ Hide ]
Fatal error: Uncaught exception 'Swift_RfcComplianceException' with message 'Address in mailbox given [] does not comply with RFC 2822, 3.6.2.'
in .../swift/lib/classes/Swift/Mime/Headers/MailboxHeader.php:352
Stack trace:
#0 .../swift/lib/classes/Swift/Mime/Headers/MailboxHeader.php(264): Swift_Mime_Headers_MailboxHeader->_assertValidAddress('')
#1 .../swift/lib/classes/Swift/Mime/Headers/MailboxHeader.php(108): Swift_Mime_Headers_MailboxHeader->normalizeMailboxes(Array)
#2 .../swift/lib/classes/Swift/Mime/Headers/MailboxHeader.php(65): Swift_Mime_Headers_MailboxHeader->setNameAddresses(Array)
#3 .../swift/lib/classes/Swift/Mime/SimpleMimeEntity.php(588): Swift_Mime_Headers_MailboxHeader->setFieldBodyModel(Array)

Where is the problem and how can i fix it?
I cant send the mails as one mail with all the adresses at once, because i need to check if every mail was sent or not.

Thanks ;)

Author:  bennot [ Tue Feb 05, 2013 3:44 am ]
Post subject:  Re: Problem with sending some mails at once

maybe you can find a solution in my code :) and maybe you can help me too


Page 1 of 1 All times are UTC - 5 hours
Powered by phpBB® Forum Software © phpBB Group