As we know, Magento uses a cron job system to send out email from core_email_queue table. There is an additional table called core_email_queue_recipients, which as the name states, will store all recipients for emails there. But these records do not get removed at times and that is usually why you will get the issue of Magento sending double emails or sending email to wrong recipients.
Follow the following steps to have this issue fixed.
1. Clean up core_email_queue_recipients table
Executing the two SQL statements below will remove any orphan email recipient records so that Magento will not send double emails or send email to wrong receipents.
DELETE FROM core_email_queue_recipients WHERE message_id NOTIN(SELECT message_id FROM core_email_queue);
DELETE FROM core_email_queue_recipients WHERE recipient_id<(SELECT recipient_id FROM(SELECT recipient_id FROM core_email_queue_recipients ORDER BY message_id ASC,recipient_id DESC LIMIT1)ASr);
2. Alter core_email_queue_recipients
Altering core_email_queue_recipients table to attach a foreign key to every recipient record so that it will get deleted when an email is done sending.
ALTER TABLE core_email_queue_recipients ADD FOREIGN KEY(message_id)REFERENCES core_email_queue(message_id)ON DELETE CASCADE;
VestaCP is a web-based control panel for you to manage your server. In fact VestaCP is a much lightweight version of the famous cPanel, which will cost you a bomb. VestaCP is open source, which means its FREE.
Apart from being free, there are commercial plugins available on VestaCP, which are actually quite useful to a certain extend.
There are two commercial plugins that are available for purchase. The good news here is that they are available in lifetime license. You can see them at the image below.
Without further delay, lets begin with the technical stuffs.
How to install VestaCP?
1. First thing to do is to download VestaCP installation script.
2. Run the installation script
Simply hit “y” for everything except filling up of your FQDN and admin email address.
When the installation completes, you should receive an email at the inbox of the admin email address that you entered previously.
4. [Optional] Upgrade default PHP 5 to PHP 7
In case you want more speed for your PHP-Powered website, you can upgrade your PHP to PHP 7 by following the following guide.