1

I have a user database with a few hundred users who need to receive a weekly update email, sent via a weekly scheduled task.

When using PHPmailer, would it be better to send one email with all users in the BCC field, or multiple emails using the standard AddAddress field?

Which is easier on the server and/or is one way more efficient than the other?

Creekstone
  • 85
  • 1
  • 4
  • I would always opt for individual emails for each and every user. This is probably heavier on the server, but I value my and other's people privacy more than server load. – Loek Jun 06 '18 at 12:30
  • PHPmailer is really efficient, if there are few hundred emails then just go for individual emails without worrying about server load. – Lovepreet Singh Jun 06 '18 at 12:35
  • You can test it with using a fake SMTP Server without woring about your user receiving mails. Like https://mailtrap.io or any similar service – Michael Jun 06 '18 at 12:36
  • mailtrap.io, I will look into that thanks. – Creekstone Jun 06 '18 at 13:47

1 Answers1

1

Individual emails. BCC is easier on the server, but gives you very little control, and there's more scope for sending the wrong thing to many people.

From a server config point of view, SMTP to localhost is the fastest (and safest) way of submitting messages.

To send individual messages efficiently, see the mailing list example provided with PHPMailer, and read the wiki article on sending to lists. The most important things are reusing the PHPMailer instance for multiple messages, clearing recipients in a loop, and using keepalive.

Synchro
  • 35,538
  • 15
  • 81
  • 104
  • Thanks, I shall look into this. Could you elaborate on what you mean by SMTP to localhost? I use `$mail->isSMTP();` in the page. – Creekstone Jun 06 '18 at 13:46
  • Yes, `$mail->isSMTP();` and `$mail->Host = 'localhost';`, but it also implies that you are running a local mail server (postfix etc). This approach is faster and safer than using sendmail, as PHP's built-in `mail()` function uses. – Synchro Jun 06 '18 at 14:36