magepal / magento2-edit-order-email

Magento2 - Edit Order Email from Admin
http://www.magepal.com
33 stars 13 forks source link

Can't send order email from admin after editing email address. #5

Closed ryan-copeland closed 3 years ago

ryan-copeland commented 3 years ago

Magento v2.4.1 PHP v7.4.14

Steps to replicate.

  1. Place an order as a guest customer.
  2. Check you receive the order confirmation.
  3. Login to the admin area, find the order and click 'Send Email' and hit OK.
  4. Check you receive order confirmation.
  5. Edit the email address on the order to a different email address.
  6. Login to the admin area, find the order and click 'Send Email' and hit OK.
  7. Check you receive order confirmation.

Expected outcome At points 2, 4 and 7 you should receive an order confirmation email.

Actual outcome Email only received on points 2 and 4. After editing the email address the email is no longer sent at point 7.

When clicking the send email button in the admin the page refreshes but no confirmation message is shown as in steps 2 and 4.

srenon commented 3 years ago

@ryan-copeland... For our extension to cause this is almost next to impossible. I also did a test on 2.4.2 and could not replicate the issue.

One possible reason you are encountering this issue could be that the new email is blocked by your email server

ryan-copeland commented 3 years ago

@srenon I can say with certainty that it's not the email server blocking the email being sent because we have logging in place and the server is not even attempting to send the email.

I'll dig deeper and find a solution.

srenon commented 3 years ago

This should be the best place to start debugging.. https://github.com/magento/magento2/blob/2.4-develop/app/code/Magento/Sales/Model/Order/Email/Sender.php#L76

ryan-copeland commented 3 years ago

@srenon thanks for this. I'll take a closer look. The strange thing with this issue is that it works fine until you edit the email address. As soon as you edit the email address using the extension it stops sending the email.

srenon commented 3 years ago

All our extension does is update multiple database fields including sales_order.cusatomer_email.

When you click the resend button, Magento uses the same sales_order.cusatomer_email.

Double-check to see if there is a leading or ending space in the email address field.

ryan-copeland commented 3 years ago

@srenon Got to the bottom of it. DKIM verification was failing which was causing the issue. Thanks for your help on this.

srenon commented 3 years ago

@ryan-copeland .... Glad to hear that you figure it out!