ebizmarts / magento2-mandrill

Mandrill integration for Magento 2.
https://mandrill.com/
36 stars 36 forks source link

Shipment emails - When got hard bounce - trials every 1 minute #104

Open ihor-sviziev opened 5 years ago

ihor-sviziev commented 5 years ago

Describe the bug When we got hard bounce - shipment emails trying to re-sent every 1 minute by cron jobs.

To Reproduce Steps to reproduce the behavior:

  1. Place an order in frontned using some not existing email (for example not existing account on gmail)
  2. Create shipment for it

Expected behavior Email should be ignored, no need to re-send it every 1 minute

Screenshots Capture 2019-03-28 at 16 02 09 Capture 2019-03-28 at 16 03 18

Desktop (please complete the following information):

Smartphone (please complete the following information):

Additional context Add any other context about the problem here.

centerax commented 5 years ago

can you let us know your Magento version and module version?

ihor-sviziev commented 5 years ago

Magento 2.2.7, module version 3.2.17

vitalygrigorishin commented 5 years ago

Hi. I have the same issue

Santiagoebizmarts commented 5 years ago

Hello @ihor-sviziev @vitalygrigorishin I am currently looking at this issue and when I try to use a fake emails I got the status ok delivered. Can you tell me the exact reason Mandrill is throwing? You should be able to check this moving the mouse over the red "Rejected" text.

Kind Regards.

ihor-sviziev commented 5 years ago

Hi @Santiagoebizmarts For "reject" we have reason "hard bounced", and for this email earlier we have hard-bounce: image

Santiagoebizmarts commented 5 years ago

Hello @ihor-sviziev Thank you very much for your feedback! I was able to find the problem. Seems like Magento does not consider the possibility that an email fails and expects all emails to be re-tried when something happens. I found this at vendor/magento/module-sales/Model/Order/Email/Sender/ShipmentSender.php lines 128 to 132. Once the solution is available I will reference it to this issue.

Kind Regards.

ihor-sviziev commented 5 years ago

Hi, In case if magento do not support it - it’s better to add some log and do not throw exception. Otherwise there will be other issues, maybe in some case customer will not be able to place order

Santiagoebizmarts commented 5 years ago

Hello @ihor-sviziev I agree with you but I want to consider if only queue emails should be catched or maybe all emails with that particular reject reason. I don't want to override any unwanted behavior because there are places where we want the exception to be thrown, for example when an incorrect sender is configured. As a manual fix for anyone experiencing this problem there is a query that should avoid that particular shipping email to continue being sent every minute. UPDATE sales_shipment SET send_email = NULL WHERE order_id = '{ORDER_ID}'; replacing {ORDER_ID} with the actual id for the order.

Important: The order id is not the number shown in the order table. It can be found accessing to the order in the back end and looking at the URL, it should be after the text "order_id/" as shown in the screenshot below: Screen Shot 2019-04-23 at 15 43 26

Kind Regards.

ihor-sviziev commented 5 years ago

Hi, Increment id in sales shipment table is not an order I’d, but shipment id

On Tue, Apr 23, 2019 at 18:02 Santiagoebizmarts notifications@github.com wrote:

Hello @ihor-sviziev https://github.com/ihor-sviziev I agree with you but I want to consider if only queue emails should be catched or maybe all emails with that particular reject reason. I don't want to override any unwanted behavior because there are places where we want the exception to be thrown, for example when an incorrect sender is configured. As a manual fix for anyone experiencing this problem there is a query that should avoid that particular shipping email to continue being sent every minute. UPDATE sales_shipment SET send_email = NULL WHERE increment_id = '{ORDER_NUMBER}'; replacing {ORDER_NUMBER} with the actual number for the order available at the order grid first column.

Kind Regards.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/ebizmarts/magento2-mandrill/issues/104#issuecomment-485841637, or mute the thread https://github.com/notifications/unsubscribe-auth/AAOJOUJOXFUGQGYAGO5U623PR4QGNANCNFSM4HCA7OGA .

Santiagoebizmarts commented 5 years ago

You are right again @ihor-sviziev I just updated the comment to avoid confusion. Sorry about that.

Please note we are already working in the solution. There will be a list of errors that will be catched, allowing adding or removing in the future.

Kind Regards.

clivewalkden commented 5 years ago

Is this still being worked on?