Pressed0024 Posted May 24, 2013 Share Posted May 24, 2013 Need some help here guys. I'm trying to set the "From" header in the Contact Us email as my store address (I need to do this before my mail server Mailjet can't accept new "From" emails every time) At /controllers/front/ContactController.php I managed to set the "From" to: $var_list, $contact->email, $contact->name, '[email protected]', ($customer->id ? $customer->firstname.' '.$customer->lastname : ''), But the problem is now the "Reply-To" header follows [email protected]. How do I set it as the customer's email? Which part should I be using the $contact->email ? Link to comment Share on other sites More sharing options...
Pressed0024 Posted May 24, 2013 Author Share Posted May 24, 2013 http://www.mailjet.com/support/i-received-an-alert-for-an-unknown-sender-detection-what-should-i-do,265.htm This is what I am trying to do. To force the Reply-To as my customer's email while having the From as my store's email for the Contact Us page only. Link to comment Share on other sites More sharing options...
eve20100 Posted September 29, 2013 Share Posted September 29, 2013 Same problem on 1.4.3 (french shop but whatever) The sender also has to be changed when a customer sends a message from his order. Because as on the contact form, customer's email is considered as the sender, and it is a problem for mailjet. Link to comment Share on other sites More sharing options...
eve20100 Posted September 29, 2013 Share Posted September 29, 2013 Hi Pressed0024, I've solved our problem !! So simple, but when you don't know... Modify the following datas : in Controllers / ContactControllers.php line 161, replace $from by your email : if (Mail::Send((int)(self::$cookie->id_lang), 'contact', Mail::l('Message from contact form'), array('{email}' => $from, '{message}' => stripslashes($message)), $contact->email, $contact->name, '[email protected]', ((int)(self::$cookie->id_customer) ? $customer->firstname.' '.$customer->lastname : ''), $fileAttachment) in Controllers / OrderDetailControllers.php line 86, replace customer->email by your email : $to, $toName, '[email protected]', $customer->firstname.' '.$customer->lastname); and it works perfectly !! Link to comment Share on other sites More sharing options...
me2013 Posted December 27, 2013 Share Posted December 27, 2013 Dear Eve20100, Thanks for this post, it has helped me. What about if order confirmation emails to the store owner via mailalerts module are not sending for the same reasons as the above topic? Do you know which file and code to alter? Thanks, ME Link to comment Share on other sites More sharing options...
me2013 Posted December 27, 2013 Share Posted December 27, 2013 Ok, maybe it's here: /modules/mailalerts/controllers/front/actions.php But what code?: class MailalertsActionsModuleFrontController extends ModuleFrontController { /** * @var int */ public $id_product; public $id_product_attribute; public function init() { parent::init(); require_once($this->module->getLocalPath().'MailAlert.php'); $this->id_product = (int)Tools::getValue('id_product'); $this->id_product_attribute = (int)Tools::getValue('id_product_attribute'); } public function postProcess() { if (Tools::getValue('process') == 'remove') $this->processRemove(); else if (Tools::getValue('process') == 'add') $this->processAdd(); else if (Tools::getValue('process') == 'check') $this->processCheck(); } /** * Remove a favorite product */ public function processRemove() { // check if product exists $product = new Product($this->id_product); if (!Validate::isLoadedObject($product)) die('0'); $context = Context::getContext(); if (MailAlert::deleteAlert((int)$context->customer->id, (int)$context->customer->email, (int)$product->id, (int)$this->id_product_attribute)) die('0'); die(1); } /** * Add a favorite product */ public function processAdd() { $context = Context::getContext(); if ($context->customer->isLogged()) { $id_customer = (int)$context->customer->id; $customer = new Customer($id_customer); $customer_email = strval($customer->email); } else { $customer_email = strval(Tools::getValue('customer_email')); $customer = $context->customer->getByEmail($customer_email); $id_customer = (isset($customer->id) && ($customer->id != null)) ? (int)$customer->id : null; } $id_product = (int)Tools::getValue('id_product'); $id_product_attribute = (int)Tools::getValue('id_product_attribute'); $id_shop = (int)$context->shop->id; $id_lang = (int)$context->language->id; $product = new Product($id_product, false, $id_lang, $id_shop, $context); $mailAlert = MailAlert::customerHasNotification($id_customer, $id_product, $id_product_attribute, $id_shop, null, $customer_email); if ($mailAlert) die('2'); elseif (!Validate::isLoadedObject($product)) die('0'); $mailAlert = new MailAlert(); $mailAlert->id_customer = (int)$id_customer; $mailAlert->customer_email = strval($customer_email); $mailAlert->id_product = (int)$id_product; $mailAlert->id_product_attribute = (int)$id_product_attribute; $mailAlert->id_shop = (int)$id_shop; $mailAlert->id_lang = (int)$id_lang; if ($mailAlert->add() !== false) die('1'); die('0'); } /** * Add a favorite product */ public function processCheck() { if (!(int)$this->context->customer->logged) die('0'); $id_customer = (int)$this->context->customer->id; if (!$id_product = (int)(Tools::getValue('id_product'))) die('0'); $id_product_attribute = (int)(Tools::getValue('id_product_attribute')); if (MailAlert::customerHasNotification((int)$id_customer, (int)$id_product, (int)$id_product_attribute, (int)$this->context->shop->id)) die('1'); die('0'); } } Link to comment Share on other sites More sharing options...
eve20100 Posted December 27, 2013 Share Posted December 27, 2013 Dear Me, Using mailjet, I have (and never had) no problem with the order confirmation email sent to me. In the configuration of "mailalert" module, have you filled in correctly the second part, about merchant notifications ? you have to check "receive an email when a new order is placed" and specify the email you want to write to. Link to comment Share on other sites More sharing options...
me2013 Posted December 27, 2013 Share Posted December 27, 2013 Hi Eve20100, Thanks for you reply. Yes, I have done all that. I will investigate further then, thanks for taking the time to write. ME. Link to comment Share on other sites More sharing options...
-Johan- Posted February 26, 2014 Share Posted February 26, 2014 Open classes/Mail.php Find : $send = $swift->send( Add before : $message->setReplyTo($from); $from = Configuration::get('PS_SHOP_EMAIL'); Works for me 2 Link to comment Share on other sites More sharing options...
AndyCZ Posted May 30, 2016 Share Posted May 30, 2016 Has anyone tried setup the same for PS 1.6.1.5, e.g. Contact Us page "Reply-To" and Order notification email "Reply-To" customer's email ? The above code is old and different for newer PS 1.6.. Many thanks. Link to comment Share on other sites More sharing options...
Recommended Posts