We are currently using SendGrid API to send transactional emails. This is very slow and it freezes the process. How do you send out 5000+ emails on a WordPress site?

We are currently using SendGrid API to send transactional emails. This overrides the wp_mail() and uses sendgrid to actually send the email instead of php mail.

Our current issue is when we use SendGrid, it processes the emails one by one and the wp_mail() function slows down and waits for it to finish before proceeding. This makes the sending out emails very slow, even with just 300+ email addresses, it takes around 5 minutes of loading time.

To anyone who already experienced this, what do you use to send out thousands of emails via WP fast? We already tried mailchimp but mailchimp does not have transactional emails functionality.

  • This looks like an interesting topic of discussion, but this isn't a discussion forum, you need to ask a specific question that can be answered factually for all people, which isn't asking for a recommendation – Tom J Nowell Mar 3 at 9:42
  1. Sending hundreds of emails from a web server will usually get that server added to spam lists, it's a great way for all your emails to get flagged as junk. It's also incredibly rude to other people on the same server, as all their emails get flagged as spam too, and violates many hosting providers terms of service.
  2. Use a service. You had the right idea using SendGrid instead of rolling your own solution.
  3. Sending 5000 emails is going to take time, it is not a quick and easy thing. Don't try to do all 5000 at once in bulk. Instead, do it in small frequent batches. Why 1 batch of 5000 when you can have 50 batches of 100 spread out across an hour? Form a queue!
  4. Sending email really isn't that simple, in order for your server to be trusted to send an email by others you have to do all sorts of additional steps with DNS and signing etc
  5. GMail etc have daily limits on how many emails you can send, e.g. Google sets 500 last I checked. Even then it wouldn't really improve the speed
  6. SendGrid probably has a faster way to send things by talking directly to their API and sending things in batches rather than one at a time
  7. Creating 5k things is going to take time, even if we don't send them, generating those emails isn't free, even if wp_mail/sending was instantaneous, it'd still take time

So what you should do:

  • Consider other transactional email providers
  • Talk directly to them instead of overriding wp_mail
  • Do smaller more frequent batches instead of one big one
  • Ask SendGrid for advice
  • Check it's the sending of the emails that's actually the problem, 5k is still a lot of emails to generate, nevermind sending them
| improve this answer | |

Not the answer you're looking for? Browse other questions tagged or ask your own question.