将 magento 联系表单电子邮件的“发件人"字段更改为发件人 [英] Change 'From' field of magento contact form email to the sender

查看:32
本文介绍了将 magento 联系表单电子邮件的“发件人"字段更改为发件人的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何将联系表单电子邮件的发件人"字段更改为发件人的字段?例如,如果客户要使用电子邮件test@test.com"填写表单,如何使生成的电子邮件来自test@test.com"?

How would one go about changing the 'From' field of the contact form email to that of the sender's? For instance, if a customer was to fill in the form with the email 'test@test.com', how can I make the generated email be from 'test@test.com'?

我查看了系统管理面板中的电子邮件发件人"字段,但这仅允许一系列预设的商店电子邮件.

I've looked at the 'email sender' field in the system admin panels, but this only allows for a range of preset store emails.

非常感谢

推荐答案

这个发送的地方在 app/code/core/Mage/Contacts/controllers/IndexController.php at abouts 行100. 邮件的回复地址似乎已经设置为帖子中的电子邮件地址,因此如果您只是想获得更轻松的回复,我建议您不要误会.

The place where this gets sent is in app/code/core/Mage/Contacts/controllers/IndexController.php at abouts line 100. It looks like the reply-to address for the emails is already set to the email address from the post, so if you're just looking to get easier replies, I'd suggest not fooling with it.

您可能会看到的另一个问题是,发送带有欺骗性发件人"地址的电子邮件可能会导致您的网站很快被许多电子邮件提供商列入黑名单,这可能会影响您的其他业务.

Another issue that you'll likely see is that sending email with a spoofed "from" address may cause your site to quickly become blacklisted from many email providers, which may affect the rest of your business.

也就是说,如果您仍然想这样做,请在该文件中稍微更改此代码:

That said, if you still want to do this, in that file change this code a bit:

            $mailTemplate->setDesignConfig(array('area' => 'frontend'))
                ->setReplyTo($post['email'])
                ->sendTransactional(
                    Mage::getStoreConfig(self::XML_PATH_EMAIL_TEMPLATE),
                    Mage::getStoreConfig(self::XML_PATH_EMAIL_SENDER), // change this
                    Mage::getStoreConfig(self::XML_PATH_EMAIL_RECIPIENT),
                    null,
                    array('data' => $postObject)
                );

希望有帮助!

谢谢,乔

这篇关于将 magento 联系表单电子邮件的“发件人"字段更改为发件人的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆