在 magento 中更改共享愿望清单邮件的发件人电子邮件地址

发布于 2024-10-22 21:44:40 字数 133 浏览 3 评论 0原文

我想更改客户与朋友分享愿望清单时发送的共享愿望清单电子邮件的发件人电子邮件地址,我尝试将客户电子邮件作为发件人地址,将客户名称作为发件人姓名,认为可以在管理员中完成,您只需将其更改为另一个,但我想要客户电子邮件,这里需要一些帮助,

谢谢

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

thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

忘你却要生生世世 2024-10-29 21:44:40

我不会那样做。相反,我会将发件人地址设置为我的网上商店的地址,并将 Reply-To 标头设置为收件人朋友的地址。来自此类地址的欺骗可能会使您的电子邮件陷入垃圾邮件陷阱。

I would not do it that way. Instead I would set the from address to be that of my web store and set the Reply-To header to be that of the recipients friend. Spoofing from addresses like that can land your email in spam traps.

陌路终见情 2024-10-29 21:44:40

浏览了一下代码后,这封电子邮件似乎是从这里发送的

app/code/core/Mage/Wishlist/controllers/IndexController.php

,所以你需要覆盖这个控制器。我从来没有做过这样的事情,但这是可行的。 这里有一个主题,如果您在谷歌上搜索“magento overridecontroller”您还会发现很多优惠信息。

之后,您必须重新实现(即复制和编辑)方法 sendAction()。在其中是一个电话,

$emailModel->sendTransactional();

我还认为您应该将发件人地址保留为商店的地址,因为
将其设置为其他地址可能会将邮件标记为垃圾邮件。但如果你想
只需将此调用的第二个参数更改为键为“name”的数组即可
和“电子邮件”以及所需的值。

但我强烈建议也设置 Reply-To 标头。这是可能的,因为该模型使用 Zend_Mail 对象来完成脏工作并将该对象视为单例。这意味着如果您首先创建它并配置它,则下一封邮件将使用此配置发送。在代码中,更改

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

成功

After browsing the code a bit, it would seem that this email is send from

app/code/core/Mage/Wishlist/controllers/IndexController.php

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.

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.

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

to

foreach($emails as $email) {
    $mail = $emailModel->getMail();
    $mail->setReplyTo($customer->getEmail());
    $emailModel->sendTransactional(
        Mage::getStoreConfig('wishlist/email/email_template'),
//snip

Success

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文