Abdullah Khan
Abdullah Khan

Reputation: 2415

Performance cost of sending an email with PHP?

Rich sites such as facebook send you an email for every event that takes place, notification, friend request and so on, I would like to know how costly is it for the web server to perform this action? that also 100s of time a day for active and popular users.

Upvotes: 0

Views: 358

Answers (2)

Simón Urzúa
Simón Urzúa

Reputation: 1546

It's a good idea group destinatarys by BCC header to reduce the email server calls, if you is using an external SMTP that it's the slower phase.

PHP only uses one thread that means that next email will be send once the current mail was sent to the SMTP server. In Java for example you can send emails in a pool of threads at same time, and course, it's faster.

Upvotes: 0

Vladislav Rastrusny
Vladislav Rastrusny

Reputation: 29965

Usually the site do not send emails itself. It just redirects email to server MTA, which then saves it in it's queue and sends when it thinks best.

To answer your question we need the definition of "costly". To send an email you typically need to execute some DNS queries, connect to remote server, exchange data with it. Is it costly in your opinion?

Upvotes: 1

Related Questions