user782104
user782104

Reputation: 13545

Using swift mailer to send personalize email

If i use SWIFT MAILER to send a thousand email:

Not personilzed case:

$message = Swift_Message::newInstance('Wonderful Subject')
  ->setFrom(array('[email protected]' => 'John Doe'))
  ->setTo(array('[email protected]', '[email protected]' => 'A name'))
  ->setBody('Here is the message itself')

It can send with one array.

However, when i have to send personalize letter

FOREACH ($name as $receiver){
$message = Swift_Message::newInstance('Wonderful Subject')
  ->setFrom(array('[email protected]' => 'John Doe'))
  ->setTo(array($receiver))
  ->setBody('Here is the message itself')}

Since the content is different , I have to use foreach to send one mail per once time??Is that more efficient way? I just have to specific the receiver name and the unsubscribe id in each mail sent.

Thank you for help

Upvotes: 0

Views: 515

Answers (1)

Maerlyn
Maerlyn

Reputation: 34107

The Decorator plugin was created for just this purpose.

Upvotes: 2

Related Questions