Skip to content

send emails stop working after migration for umbraco 15 #705

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
marvingbh opened this issue May 8, 2025 · 29 comments
Closed

send emails stop working after migration for umbraco 15 #705

marvingbh opened this issue May 8, 2025 · 29 comments

Comments

@marvingbh
Copy link

marvingbh commented May 8, 2025

Which component is this issue related to?

Umbraco Commerce (Core)

Which Umbraco Commerce version are you using? (Please write the exact version, example: 10.1.0)

15.2.2

Bug summary

After migration to Umbraco 15, the order confirmation email stop working. I've notice a weird thing when using the UI to try send the e-mail, the default language is setup to ucModals_sendEmailPlaceholder, is that some variable that I need to set?

Image

I'm guessing this is the cause of the issue but I don't know how to fix it. can you help me?

found this on the logs:

Image

Specifics

No response

Steps to reproduce

Migrate a website from 13 to 15
Try to buy something
email does not work

Expected result / actual result

No response

Dependencies

No response


This item has been added to our backlog AB#52853

@marvingbh marvingbh added the bug Something isn't working label May 8, 2025
@umbracotrd
Copy link

Hi @marvingbh , the latest version is now 15.3.4 with a multiple bug fixes. Can you give it a shot?

By the way can you describe the upgrade process from 13 to 15? Like, when you're at version 13.x.x, did you upgrade to 14 or jumped straight to 15.2.2?

@marvingbh
Copy link
Author

@umbracotrd I've tried with 15.3.4, same problem, about the migration we migrate from 13 to 15, skipping 14.

@marvingbh
Copy link
Author

any update on this?

@umbracotrd
Copy link

umbracotrd commented May 12, 2025

About the ucModals_sendEmailPlaceholder, it's just a translation error, it does not block the email sending process. You can add your own translation file to fix it temporary, we'll push the fix for it in the next patch.

About the emails stop working, can you to go any order and try send out test emails using other email templates? I want to know if all emails stop working or just the order confirmation one. If you see any errors in the log relates to email sending, please share in this post.

Image

@marvingbh
Copy link
Author

On the order webpage, emails are sent correctly when I select the appropriate language, regardless of the template. However, when an order is confirmed, the confirmation email is not automatically sent. I suspect this is because the system is using default values instead of the selected language settings, which prevents the email from going out.

Image

@umbracotrd
Copy link

Can you access the database? If you can, please run this query select top 100 languageIsoCode, * from umbracocommerceorder where languageIsoCode IS NULL order by createDate desc to see if the languageIsoCode is null for some orders.

The language info's supposed to be saved for each order and the email service will use that language to send out the emails.

@marvingbh
Copy link
Author

there is none null. the most common are:

Image
by this query: select languageIsoCode, count(1) count from umbracocommerceorder group by languageIsoCode order by COUNT(1) desc

@umbracotrd
Copy link

Yeah, that’s a problem. languageIsoCode is supposed to store the... well, the language ISO code. Any idea how those values ended up there?

@marvingbh
Copy link
Author

we don't do anything different, we use headless and the cart code is in react, but calling the umbraco api. in production we have the version 13 running, and the values are like this:

Image

in v13, it works fine the confirmation email.

@umbracotrd
Copy link

when creating/updating an order using the storefront api, are you passing language in the request body?

If you are, please check the value you're passing to language property. It should be a string ISO code for the System.Globalization.CultureInfo constructor.

If you're not then you can start passing the language property in the request and it should fix the issue for upcoming orders while wait for the fix from our end.

@marvingbh
Copy link
Author

I'm not passing language in the body, I just migrate from v13 where was working, and now is not working anymore. all those fields are optional by the documentation.

@mattbrailsford
Copy link
Contributor

@marvingbh they are optional, but the default behaviour is to fall back to the Accepts-Language header, but it's clear we should be doing more processing to extract the culture value, rather than just using it raw.

@umbracotrd's suggestion to pass the language is to prevent this default behaviour from running and using an explicit language code. We of course will look to fix this issue, but this was just a suggestion to get things working in the meantime.

@marvingbh
Copy link
Author

got it. will pass the language and let you know if it works.

@marvingbh
Copy link
Author

same error passing the language once creating the order, nothing changed.

@marvingbh
Copy link
Author

@mattbrailsford @umbracotrd in the order the language is now correct, but still not sending email

Image

the error msg is the same:
System.Globalization.CultureNotFoundException: Culture is not supported. (Parameter 'name') en-US,en;q=0.9,pt-BR;q=0.8,pt;q=0.7 is an invalid culture identifier. at System.Globalization.CultureInfo..ctor(String name, Boolean useUserOverride) at Umbraco.Commerce.Core.Templating.ViewTemplateEngine.RenderTemplateViewAsync(String templateViewPath, Object model, String languageIsoCode, CancellationToken cancellationToken) at Umbraco.Commerce.Core.Pipelines.Email.Tasks.RenderEmailTemplateTask.ExecuteAsync(EmailSendPipelineArgs args, CancellationToken cancellationToken) at Umbraco.Commerce.Common.Pipelines.Tasks.PipelineTaskWithTypedArgsBase`2.ExecuteAsync(PipelineArgs`1 args, CancellationToken cancellationToken) at Umbraco.Commerce.Common.Pipelines.Tasks.PipelineTaskBase`2.ExecuteAsync(PipelineArgs args, CancellationToken cancellationToken) at Umbraco.Commerce.Common.Pipelines.InProcPipelineInvoker.<>c__DisplayClass2_0.<<Umbraco-Commerce-Common-Pipelines-IAsyncPipelineInvoker-InvokeAsync>g__NextAsync|0>d.MoveNext() --- End of stack trace from previous location --- at Umbraco.Commerce.Common.Pipelines.InProcPipelineInvoker.<>c__DisplayClass2_0.<<Umbraco-Commerce-Common-Pipelines-IAsyncPipelineInvoker-InvokeAsync>g__NextAsync|0>d.MoveNext() --- End of stack trace from previous location --- at Umbraco.Commerce.Common.Pipelines.InProcPipelineInvoker.<>c__DisplayClass2_0.<<Umbraco-Commerce-Common-Pipelines-IAsyncPipelineInvoker-InvokeAsync>g__NextAsync|0>d.MoveNext() --- End of stack trace from previous location --- at Umbraco.Commerce.Common.Pipelines.InProcPipelineInvoker.Umbraco.Commerce.Common.Pipelines.IAsyncPipelineInvoker.InvokeAsync(IEnumerable`1 pipelineTasks, PipelineArgs args, CancellationToken cancellationToken) at Umbraco.Commerce.Common.Pipelines.Pipeline.ExecuteAsync[TPipeline,TArgs,TEntity](Func`1 argsFactory, CancellationToken cancellationToken) at Umbraco.Commerce.Core.Services.EmailTemplateService.SendEmailAsync[TModel](EmailTemplateReadOnly emailTemplate, TModel model, String toEmailAddress, String languageIsoCode, CancellationToken cancellationToken) at Umbraco.Commerce.Core.Events.Notification.Handlers.Order.SendFinalizedOrderEmail.HandleAsync(OrderFinalizedNotification evt, CancellationToken cancellationToken)

@mattbrailsford
Copy link
Contributor

Did you modify the DB directly? If so, the order might still be in a cache. If you get the Order service from DI container you can get it to clear the cache for an order. Or a simpler option would be to just restart the app if you can.

@marvingbh
Copy link
Author

no, I updated the order payload when creating the order. is a new order, so no cached.

@mattbrailsford
Copy link
Contributor

Well from the exception it's clearly getting the language from the Accepts-Language header for some reason so may mean it's ignoring the orders language setting 🤔

Is that error from when you send an email from the backoffice? or when going via checkout?

@marvingbh
Copy link
Author

via checkout flow get the error, on Backoffice I have the same behavior as before, the dropdown shows

Image
if I try to send with the default values, it give me the same error:

If I open it and choose the correct language, it works.

Image

@mattbrailsford
Copy link
Contributor

Ok, so that is interesting as checking the send email controller that handles sending the email, that doesn't fallback to the Accepts-Language header so it just falls back to the orders language ISO code if one isn't passed. But this would then make it that the order must have a non-valid en-US,en;q=0.9,pt-BR;q=0.8,pt;q=0.7 value 🤔

@marvingbh
Copy link
Author

any workaround or needs a new version to fix?

@mattbrailsford
Copy link
Contributor

Are you positive the email you sent in the back office is for an order with a valid languageIsoCode set? The error suggests not as like I mentioned yesterday, the email sending routine doesn't fall back to the Accepts-Language header.

@marvingbh
Copy link
Author

Yes, the email I sent in the back office is for an order with a valid languageIsoCode set. In backoffice, it works correctly if I select the correct language in the dropdown. However, if I don’t change the dropdown and attempt to send the email as it opens, I encounter the same error. This behavior is identical to what happens when an order is completed—the confirmation email fails to send. I’ve also created a new order with the language explicitly set, but it still fails.

Image

Image

@mattbrailsford
Copy link
Contributor

Yea, I'm just wondering where that en-US,en;q=0.9,pt-BR;q=0.8,pt;q=0.7 is coming from as it shouldn't be checking the header 🤔

@umbracotrd
Copy link

@marvingbh I've just pushed 15.3.5--preview.2+4807bd8 to Umbraco Nightly feed with the fix for existing orders's languageIsoCode and prevent new orders from getting unexpected language values.

Can you give it a shot? Remember to backup your database before installing the new version though.

@marvingbh
Copy link
Author

@umbracotrd it works, thank you very much!

@marvingbh
Copy link
Author

@umbracotrd when the new version will be released?

@mattbrailsford
Copy link
Contributor

We should be able to look at getting it out this week 👍

@umbracotrd
Copy link

15.3.5 with the fixes is out now 🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants