Developer forum

Forum » Ecommerce - Standard features » Order Confirmations sometimes not sent

Order Confirmations sometimes not sent

Anett Nissen
Anett Nissen
Reply

Hi there

We have a Client on 9.9.8 with a problem that has been going on for quite som time and the Support team directed me to try to get some help here on the Forum.

The problem is that 1 out of maybe 50 orders a confirmation email is not sent to the B2C customer from DW
The line in the Orderlog that normally shows which email the Confirmation has been sent to is simply missing from the log

It looks like an error happens in this method - it does log "Send notification emails.", but it does not get to log which adress it sends to. Inbetween the 2 normal loglines an error seems to happen. Unfortunately the error does not seem to be catched and logged

// Dynamicweb.Ecommerce.Cart.Frontend
private static void SendMails(Order order, ModuleSettings settings, int pageID) 

Anybody with experience on this or who can maybe take a look at types of errors that may not be catched and logged with this metod?


Replies

 
Nicolai Pedersen
Reply

Hi Anett

Can you check the eventviewer from monitoring or from Settings/Ssystem and see if you have any entries for "Application/SMTP" - and on the time the email is missing.

It could be a SMTP related exception - that should be in this list then (and the error cannot be seen on the order).

If you have exceptions, a copy of the not sent email should also be located in filemanager:

In SMTP settings, you can also try to set the "Save all emails to disk" - to see if we catch the missing email to retain more information on why it does not send.

All of this will only give you some information if the error that happens is related to SMTP.

If any other exception happens, you will have a order log entry saying "Unable to send order and receipt mails for order {0} {1}"

One more thing to check is if you have a notification subscriber that listens to Ecommerce.Notifications.Ecommerce.Cart.SendingConfirmationMail that sets StopSendingMoreMails or SkipThisMail properties on the passed arguments to true... If this is the case, that cannot be seen in any logs - the mails are just not send.

Let me hear if any of this will give you some findings - or we will have to dig deeper!

BR Nicolai 

 
Anett Nissen
Anett Nissen
Reply

Hi Nicolai

The Emailhandler log has no registration at 09:04:38 - But at 09:04:13 a registration for email sent after Indexing has been registered and the next log entry after this is 09:55

But delivery of several emails the same minute should be no problem for the log and the sending. I have checked some of the other Orders with missing Confirmation email and no log entry in Order Log and they do not have any entry in the EmailHandler log either and there seems not to be emails sent the same minute in these instances

SMTP is set up to save emails to disk

The server is setup to send emails via SendGrid. There are no logs directly on the server at 09:04:38

A backender has checked our notification subscribers and confirmed that we do not use any subscribers in the proces of finalizing an order on the solution

I hope that you can help me take a look at if there is something we can do to make errors happening visible

If any other exception happens, you will have a order log entry saying "Unable to send order and receipt mails for order {0} {1}" - Is this something that I should be able to see in the Orderlog or in the Emailhandler log?

 
Morten Bengtson Dynamicweb Employee
Morten Bengtson
Reply

Hi Anett,

We previously had an issue with our checkout handler which caused an exception during checkout due to an error in stock management.
The error only occurred for certain orders with discount order lines (and maybe other types of order lines). 
The order was completed, but the confirmation email was not being sent.
That issue (#1642) was fixed in the 9.10.6 release.

If it is the same issue you are experiencing on your solution then you should have an entry in the order log similar to this:
Dynamicweb.Ecommerce.CheckoutHandlers.QuickPayPaymentWindow.QuickPayPaymentWindow ERROR: Unhandled exception with message: Object reference not set to an instance of an object.

If you find that error in the order log then you are experiencing the same issue and you will have to upgrade to version 9.10.6 or later.
Sorry about the inconvenience.

Best regards,
Morten

 
Anett Nissen
Anett Nissen
Reply

Hi Morten

There are no errors in the Orderlog from CheckoutHandlers.QuickPayPaymentWindow.QuickPayPaymentWindow

I have orders with discount lines included - some do not receive mail and others do (so no apparent pattern in this)

I have orders with missing emails using different Quickpay methods as well (Mobilepay, Paypal)

There is no pattern in regards to types of email domain either. And online checks on emails alsp verifys them as Valid mails (Gmail, Hotmail, Stofanet and private domains)

Emails are set to be stored in the archive. There is nothing stored on these orders in the emailarchive and no log in the emailhandler on the time of sending email or any other time if you search the log with the email it should be sent to

It is very odd what may happen and to get to the bottom of it we would need som kind of log-help

Allan suggested this from his analysis. We use the SendMails method:

It looks like an error happens in this method - it does log "Send notification emails.", but it does not get to log which adress it sends to. Inbetween the 2 normal loglines an error seems to happen. Unfortunately the error does not seem to be catched and logged

// Dynamicweb.Ecommerce.Cart.Frontend
private static void SendMails(Order order, ModuleSettings settings, int pageID) 

Do you think it is possible to catch this somehow. The solution is not quite ready to be updated to 9.10 yet - we are in the middle of developing a new shopsite

 
Nicolai Pedersen
Reply

If there is an exception inside SendMails, it will have this entry in the order log: "Unable to send order And receipt mails for order {id} {exception}". Also on 9.9. So there is no exception.

It seems like there is no paragraph settings on this page - because if the loop of sending emails is activated you will see entries like this:

Notification mail, To: '{receiverString}', Subject: '{mailInfo.Subject}', From: '<{mailInfo.SenderMail}> {mailInfo.SenderName}'

So - I think the callback comes in on a 'wrong' page id. I noticed in your screendump in your first post on this thread with a message saying "Order called checkoutdone (pageID:0) ..." The 0 being the problem. So the callback handles the completenes of the order - and it seems like that callback comes in on pageid 0. That is not good - it has to be an ID of a page that has the cart app on it - because that is where it loads the sending settings from. So if ID is 0, there is no page and there is no cart app with settings. So the code enters the loop to send mails - settings is not there and there is nothing to send...

So we need to figure out what that callback URL is and why it is wrong...

The reason you only see this sometimes could be that callback comes in before the receipt is showed - other times the other way around.

BR Nicolai

 
Nicolai Pedersen
Reply

I think I have found a workaround for this.

If the pageid is missing in this case, we can retrieve the id of the checkout page that started the process - so given that the checkout and payment is the same instance (usually it is), then I might have made a fix to handle that case.

Attached find a new 9.9 Dynamicweb.Ecommerce with the change in it. Can be used for testing. We will also test and push to a release.

BR Nicolai

 
Anett Nissen
Anett Nissen
Reply

Tak Nicolai og Morten

Vi kigger lige på det nu her efter ferien og vender retur hvis det er løsningen

 
Anett Nissen
Anett Nissen
Reply

Hej Nicolai

Vi har lagt koden på. Allan har bedt mig indsende denne - kan du tyde det for os? Det ser ud som om der kommer en fejl pga en fejl

 
Nicolai Pedersen
Reply

Hi Anett

Attached find another update that should handle the exception of exception. It also tries to log the wrong message string that seems to cause it.

It is a Ecommerce for 9.9

 
Anett Nissen
Anett Nissen
Reply

Hi Nicolai

We updated the solution yesterday afternoon with the new code, but unfortunately we get the same "meta" error

Can you take a look at if another change is needed or the attatched code is the new one?

Thanx Anett

 
Anett Nissen
Anett Nissen
Reply

Hi Nicolai - have you seen resonse concerning latest codefix?

 
Anett Nissen
Anett Nissen
Reply

Hi again

It seems that no Order Confirmations have been sent since implementing the new code. I think we will have to backtrack and take it of again until further testet

Is there anything in the codechange that would block all Order Confirmation mails from being sent?

Best regards Anett

 
Anett Nissen
Anett Nissen
Reply

Hi Nicolai

Can you help us take a look at the hotfix you made? The Client is asking me for an update

Best regards Anett

 
Nicolai Pedersen
Reply

Hi Annett

Please find attached yet another version of this assembly (9.9).

Can you email a link to the solution? I would like to take a look at the log files...

Sorry about the wait!

BR Nicolai

 
Anett Nissen
Anett Nissen
Reply

Email is sent. I will notify you when we have implemented the new file

Best regards Anett

 
Anett Nissen
Anett Nissen
Reply

Email is sent. I will notify you when we have implemented the new file

Best regards Anett

 
Anett Nissen
Anett Nissen
Reply

The new file is now live on the site

 
Anett Nissen
Anett Nissen
Reply

Hi Nicolai

The Client has not received messages with missing Order confirmations in a while

If I look at an order log. There seems to be a new line added to the log with the same sort of Error message for all orders. What is your take on that? Something to adjust?

 
Nicolai Pedersen
Reply

This happens because of an invalid message string that does not esacpe string format brackets {OrderID}.

I have attached an update of ecommerce.dll 9.9 that handles that problem

BR Nicolai

 
Nicolai Pedersen
Reply

And an update of that dll.

 
Anett Nissen
Anett Nissen
Reply

Hi Nicolai

We now have another missing OB


The Order log shows only 1 line og code "Found settings for 0 emails on page" - but Order has saved an email
Can you maybe take a look directly in the Solution? Order: 90015704

 
Andrejs Zavorotnijs
Reply

Hi All

We have something very similiar in one of our solutions and only with QuickPay.

This happens every ~2-3 days

We already check OrderdebuggingInfo for every order without notifications, compare with normal order, but didn't find any differences.

For normal orders with notifications

orders without notification

And no any log in EmailHandler

 
Nicolai Pedersen
Reply

Both of you - can I see the setup of your quickpay checkout handler? And the template you are using.

Thanks, Nicolai

 
Andrejs Zavorotnijs
Reply

Hi Nicolai.

Thanks for fast reply.

 
Nicolai Pedersen
Reply

Thanks - was looking for the post mode.

@Anett. I can see on your latest screendump that the pageid that is used to complete the cart and send email is 2874 which is your json cart. That id comes from Order.CheckoutPageId which is updated on every pageview with the cart module on it. So something indicates that the order is saved with this ID on it after the checkout has started. I remember we had a situation with mobilepay giving issues where this json page was called during the checkout. I think this might be a similar issue. Because if that json page is called after checkout is started, the CheckoutPageId is updated to the id of the json page resulting in DW finding the wrong cart instance to send emails. Could that be the case? 

A possible workaround until issue is located is to add the email notification settings to that page as well.

@Andrejs: Thanks - I was looking for autopost mode - ýour settings look fine. What version are you using? And do you have more than one cart instance on this website? Do you have the pageid as part of the log entries (you have clipped something) - the pageid is not there unless you use a very new Ecommerce 9.10 dll.

BR Nicolai

 
Andrejs Zavorotnijs
Reply

We are using 9.10.12 in this solution

without notifications

with notification

We are using Cart, Cart: JSON and Checkout, Checkout: JSON

And notifications configured only in Checkout 

 
Nicolai Pedersen
Reply

Hi Andrejs.

Can you email me the solution url? I am pretty sure you have more than one cart instance on the solution and that both of them are 'touched' during checkout causing this to happen...

BR Nicolai

 
Nicolai Pedersen
Reply

Hi Andrejs

I can see that this solution is based on the same implementation as the one Anett is having issues with.

The problem is that a lot of 'chatter' is happening during the checkout process to the JSON page - also after the actual checkout process starts:

PageID: 3249 is the checkout page, 2768 is the json page - that does something?

As you can see below, after the user starts the payment on page 3249, the 2768 page is called many times, and that changes the OrderCheckoutPageID on the order after the payment has started.

So when the callback to Dynamicweb is coming from Quickpay, it will use the settings of 2768 to complete the checkout instead of the settings on 3249 which is the correct one.

So there are 2 options:

  • Do not call the json endpoint after payment has started
  • Use the samme confirmation settings on both cart instance

BR Nicolai

 
Nicolai Pedersen
Reply

One last alternative is to change the autopost setup of the quickpay payment to a manual version and override the callback URL to include the pageid. That might help.

 
Nicolai Pedersen
Reply

We just discussed this. We will try to make an update to how we update the checkoutpageid on the order so that we will not update it after payment has started. Should work and then solve your specific issue.

BR Nicolai

 
Anett Nissen
Anett Nissen
Reply

Thanx Nicolai

As I read last reply is that we are on stand-by for an updated DLL?

Correct perception?

Anett

 
Nicolai Pedersen
Reply

Yes, we have made a change that will try to fix the problem for you. But because of the amount of calls to the json endpoint, we cannot be sure that it will always do the trick.

Also the log indicates that something goes into an unwanted loop from js talking to that json endpoint too much.

The pull request for this has been made and is awaiting approval and testing. New dll expected Tuesday. I can give you a pirate version if you so desire.

BR Nicolai

 
Allan Iversen
Allan Iversen
Reply

Hi Nicolai,

Any news regarding fix? - is the fix ready, also for DW 9.9. Client running on 9.9.8.

 
Allan Iversen
Allan Iversen
Reply

Hi Nicolai,

Has this been fixed in DW 9.10?

 
Nicolai Pedersen
Reply

Yes, it is in Dynamicweb.Ecommerce 1.10.105 and newer https://www.nuget.org/packages/Dynamicweb.Ecommerce/1.10.105

Devops#5079

BR Nicolai

 

You must be logged in to post in the forum