将magento联系表单邮件的'From'字段更改为发件人 [英] Change 'From' field of magento contact form email to the sender
问题描述
如何将联系表格的发件人字段更改为发件人的发件人字段?例如,如果客户用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 /控制器/ IndexController.php
在约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.
这就是说,如果你仍然想这样做e更改此代码:
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)
);
希望有帮助!
谢谢,
Joe
Thanks, Joe
这篇关于将magento联系表单邮件的'From'字段更改为发件人的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!