• Does anyone know if running wp_mail in a loop will reuse the connection to the server in some way, or if it will draw resources for authentication each time it sends one email?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Dion

    (@diondesigns)

    If you are using a plugin to send email through a service such as Mailchimp or Amazon SES, and the plugin supports batch delivery, then it may require only one connection. Otherwise, it will require a separate connection for every discrete email being sent.

    Thread Starter Dekadinious

    (@dekadinious)

    I am thinking only of wp_mail directly towards the server. I’ll have to code something new then 😊

    Dion

    (@diondesigns)

    WordPress uses an email package called PHPMailer. PHPMailer has a large number of options/features that aren’t used by WordPress core, but they can be used by plugins. Here’s some code on the PHPMailer site that demonstrates the use of SMTP keepalive to send emails to a mailing list:

    https://github.com/PHPMailer/PHPMailer/blob/master/examples/mailing_list.phps

    This method used might be possible with a WordPress plugin that hooks a specific action in the wp_mail() function. However, I suspect that you might need to bypass wp_mail() and use PHPMailer directly to send the emails.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Will wp_mail reuse authentication?’ is closed to new replies.