Hello, I use Magento 1.9.3.2 and already for a couple of months the transactional message of emails sales confirmation of New order is sent to more customers in purchases made on the web, apart from the customer who has made the Purchase. I do not know how to fix it or setup to play as they call me customers saying that they get a message from a purchase they have not done:/.
I have only found these post in English that also give a solution for those who do not know how to play Magento and where to play sounds like Chinese. Https://magento.stackexchange.com/questions/95906/magento-order-email-sending-to-wrong-customer
https://community.magento.com/t5/Ma...nt-to-multiple-different-customers/td-p/40919
This seems to be one of the solutions:
"there appear to be a missing foreign key constraint on the core_email_queue_recipeints table, so when the cron job clears the Core_email_queue table the recipients are left, and the truncation resets the primary key to 1, causing possible collisions of past customer Email addresses with new Orders.
To fix the problem in Magento 1.9:
DELETE from core_email_queue_recipients WHERE message_id NOT IN (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 LIMIT 1) AS r);
ALTER TABLE core_email_queue_recipients ADD FOREIGN KEY (message_id) references core_email_queue (message_id) ON DELETE cascade;
This will clear the orphan records from the recipient table, and apply the missing FK rule to the Database. "
And in another place it puts This:
Fortunately the solution for this problem is easy to perform.
All you need to do is clean up the repeated message IDs in the Core_email_queue_recipients table and making sure that when a message is removed from the Core_email_queue table, at the same time your corresponding recipients have deleted In the Core_email_queue_recipients table.
The best way to accomplish this is to create a foreign key that links these logs and removes Cascades (but you need to do some cleanup before you can do that).
This is the procedure for solving the problem:
1) run the following two SQL queries to clear the Core_email_queue_recipients table from the orphaned records and IDs repeat Messages:
DELETE from core_email_queue_recipients WHERE message_id NOT IN (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 LIMIT 1) AS r);
The first query removes orphaned records and second erases old records that are no longer valid.
2) create a foreign key in the Core_email_queue_recipients table to delete the cascading beneficiary records. The SQL query to create this foreign key is:
ALTER TABLE core_email_queue_recipients ADD FOREIGN KEY (message_id) references core_email_queue (message_id) ON DELETE cascade;
By using this new foreign key, orphaned records will not remain on the core_email_queue_recipients table when you clean the core_email_queue table, and no repeated messages to the wrong recipients will be sent in the Future. "
But I don't know where I have to write those DELETE commands and everything that follows, since they don't say it. Can be in the path App/code/core/Mage/core/etc/config. xml? Someone would know something? Thank you