简体   繁体   中英

Magento 2 is sending Emails in english if sent programmatically

I'm looking for hours now and I found some topics that are similar but none of them solved my issue.

I'm writing a Magento 2.3 Extension to import customers from a different Database. Everything works fine except for the email language.

I would expect Magento to use automatically the correct language (store config) when i'm sending the "New Account Email"

Here is the method I'm using to send the Email

$customer->sendNewAccountEmail();

If I send the "Password Reset" Email by clicking on the corresponding Button in the customer settings, Magento sends the Email in the correct language.

I tried different config settings and different ways of set the locale inside my import method. Obviously nothing worked.

对我来说,以下工作有效:

$customer->sendNewAccountEmail('registered', '', $storeID);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM