Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adjust documentation to avoid accumulating recipients in a loop (resulting in multiple mails received by same recipient) #191

Merged
merged 1 commit into from
Jul 13, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 6 additions & 9 deletions docs/book/transport/smtp-multiple-send.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,15 @@ $transport = new Smtp([
]);

// Create a base message:
$template = new Message();
$template->addFrom('sender@example.com', 'John Doe');
$template->addReplyTo('replyto@example.com', 'Jane Doe');
$template->setSubject('Demo of multiple mails per SMTP connection');
$template->setBody('... Your message here ...');
$message = (new Message())
->addFrom('sender@example.com', 'John Doe')
->addReplyTo('replyto@example.com', 'Jane Doe')
->setSubject('Demo of multiple mails per SMTP connection')
->setBody('... Your message here ...');

// Loop through recipients:
foreach ($recipients as $address) {
// Clone the message and add a recipient:
$message = clone $template;
$message->addTo($address);

$message->setTo($address);
$transport->send($message);
}
```
Expand Down