简体   繁体   English

如果以编程方式发送,Magento 2 将发送英文电子邮件

[英]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.我正在编写一个 Magento 2.3 扩展来从不同的数据库导入客户。 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"当我发送“新帐户电子邮件”时,我希望 Magento 自动使用正确的语言(商店配置)

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.如果我通过单击客户设置中的相应按钮发送“密码重置”电子邮件,Magento 会以正确的语言发送电子邮件。

I tried different config settings and different ways of set the locale inside my import method.我尝试了不同的配置设置和在我的导入方法中设置语言环境的不同方法。 Obviously nothing worked.显然没有任何作用。

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

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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