Yii Framework Forum: Getting Exception for multiple receivers usimg Swiftmailer - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Getting Exception for multiple receivers usimg Swiftmailer [canceled]

#1 User is offline   tklustig 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 419
  • Joined: 20-April 17
  • Location:Hannover

Posted 14 March 2018 - 06:27 AM

Hi guys, follwoing code will send mail to multiple recievers as intended

            $SendObject = Yii::$app->mailer->compose()->setFrom($string)
                                ->setTo(array('goetz.bewerber@gmx.net','schulze.bewerber@gmail.com','susanne.bewerber@web.de'))
                                ->setHtmlBody($model->bodytext)
                                ->setSubject($model->betreff)
                                ->setTextBody($model->bodytext);
                        $SendObject->send();



Unfortunately, I will get Exception if I try like this:
$ZieladresseTest = "'goetz.bewerber@gmx.net','schulze.bewerber@gmail.com','susanne.bewerber@web.de'";

           	$SendObject = Yii::$app->mailer->compose()->setFrom($string)
                                ->setTo(array($ZieladresseTest))
                                ->setHtmlBody($model->bodytext)
                                ->setSubject($model->betreff)
                                ->setTextBody($model->bodytext);
                        $SendObject->send();



Exception:

Address in mailbox given ['goetz.bewerber@gmx.net','schulze.bewerber@gmail.com','susanne.bewerber@web.de'] 
does not comply with RFC 2822, 3.6.2.

Any ideas,
  • why exception will be thrown out
  • how to avoid Exception using variables for setTo() ?

0

#2 User is offline   tklustig 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 419
  • Joined: 20-April 17
  • Location:Hannover

Posted 16 March 2018 - 04:31 AM

This thread has been canceled
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users