在magento中更改共享心愿单邮件的发件人电子邮件地址 [英] change sender email address of share wishlist mail in magento
问题描述
我想更改客户与朋友分享愿望清单时发送给客户的共享愿望清单电子邮件的发件人电子邮件地址,我试图将客户电子邮件作为发件人地址,并将客户名称作为发件人姓名,认为可以在管理员中完成,您只需将其更改为另一个即可,但我要向客户发送电子邮件,请在此处寻求帮助
i want to change the sender email address of the share wishlist email a customer send when share his wishlist with a friend, i'm trying to put the custmer email as the sender address, and the customer name as the from name, thought it could be done in the admin, you just can change it to another one, but i want the customer email, need some help here
谢谢
推荐答案
稍微浏览一下代码后,看来这封电子邮件是发自
After browsing the code a bit, it would seem that this email is send from
app/code/core/Mage/Wishlist/controllers/IndexController.php
因此,您需要覆盖此控制器.我从来没有做过这样的事情,但这是可行的.有一个主题此处,如果您是谷歌的"magento覆盖控制器"您还会发现很多信息.
So you need to overwrite this controller. I have never done such a thing, but it is doable. There is a topic here and if you google 'magento override controller' you'll also find a lot off info.
此后,您必须重新实现(意味着复制和编辑)方法sendAction()
.里面有电话
After that you must re-implement (meaning copy and edit) the method sendAction()
. In it is a call
$emailModel->sendTransactional();
我还认为您应该将发件人地址留给商店,因为 将其设置为其他地址可能会将邮件标记为垃圾邮件.但是如果你想 只是将此调用的第二个参数更改为键为名称"的数组 和电子邮件"以及所需的值.
I also think you should leave the sender address to that of the store, because setting it to another address might mark the message as spam. But if you want to do it just change the second parameter of this call to an array with keys 'name' and 'email' and the desired values.
但是我强烈建议您也设置Reply-To标头.这是可能的,因为此模型使用Zend_Mail对象进行肮脏的工作并将此对象视为单例.这意味着,如果您首先创建它并对其进行配置,则将使用此配置发送下一封邮件.在代码中,更改
But I strongly advise to set the Reply-To header too. That is possible because this model uses a Zend_Mail object to do the dirty work and treats this object as a singleton. Meaning that if you create it as first and configure it, the next mail will be sent with this configuration. In code, change
foreach($emails as $email) {
$emailModel->sendTransactional(
Mage::getStoreConfig('wishlist/email/email_template'),
//snip
到
foreach($emails as $email) {
$mail = $emailModel->getMail();
$mail->setReplyTo($customer->getEmail());
$emailModel->sendTransactional(
Mage::getStoreConfig('wishlist/email/email_template'),
//snip
成功
这篇关于在magento中更改共享心愿单邮件的发件人电子邮件地址的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!