Hello
I'm currently working on a Laravel project where I need to send emails to a substantial number of recipients, approximately 10,000 at a time. I want to ensure that I'm following the best practices to optimize performance and prevent any potential issues. I want to get notify all user by email at the same time, all user must receive email at the same time without any delay
It takes too much time also dropped loading performance?
what is the best way to send email all user at the same time?
And also If some emails failed, how to fix them?
Like @arifthefinix said you should use a Job for this. These jobs run in queue in the background and will help you improve the performance for sending all these emails. You can implement the failed method in your job class to log or handle the failed jobs when emails failed to send.
@ihprince That depends on a lot of factors.
10k emails will never be received at exactly the same time but very close to each other if your setup is good.
Also make sure that your smtp / mail server is set up correctly to handle these amount of mails going out and that the delivery for example to outlook goes well.
EDIT: Like others have already metioned in this post, handling your own mail server can be challenging because of several reasons like for example email deliverability. So looking into using an external mail service might be an easier solution than doing it via your own server.
@ihprince on that scale, I would be using a service such as Mailchimp, Sendgrid, Mailgun etc. They already have the APIs and the tools to handle mailing large numbers of recipients; your integration with one of these services is relatively easy by comparison.
@tykus Not to mention that, if you don’t know exactly what you’re doing with your e-mail server and put a lot of work into maintaining things, sending this amount of e-mails from your own mail server is likely to result in a severe hit to its IP reputation, which will in turn mean that your recipients are less likely to receive your e-mails.
@ihprince You’re better off using a service that actually deals with sending bulk emails, such as Mailchimp or Campaign Monitor. Because if you try and send that many emails from a plain server, then you run the risk of getting your server’s IP address black-listed, and then any email you send will be marked as spam.
In Laravel, I use Queues + Mailables with SMTPwire for smooth bulk sending. I warm up domains using WarmupSMTP and track delivery via Mailtrap. Fast, reliable, and inbox-friendly.