0

is it possible on magento make the email that sends the order be different with the reply email order from the client?

For example i wish when the client receives the order email, it shows email A that send him, but when he makes reply to the order email, it replys to email B.

Is it possible in magento? I cant find this specific option on the backend.

2
  • You want send Email with email_ID_1 and for customer reply you want to set reply ID as email_ID_2? Commented Jan 12, 2018 at 12:26
  • Yes, exactlly! :)
    – Info E
    Commented Jan 12, 2018 at 12:28

1 Answer 1

0

Basically, you have to set reply_to parameter for message

I am not getting any shorter way...

Below code is not TESTED

First of all sales NEW ORDER EMAIL uses Mage_Core_Model_Email_Template_Mailer which do not have setReplyTo function, so you have to create it

public function setReplyTo($email){  //added
     $this->setData('reply_to', $sender);
     return $this;
}

Now have to pass additional parameter to sendTransactional function of core/email_template

$emailTemplate->setDesignConfig(array('area' => 'frontend', 'store' => $this->getStoreId()))
                ->setQueue($this->getQueue())
                ->sendTransactional(
                    $this->getTemplateId(),
                    $this->getSender(),
                    $emailInfo->getToEmails(),
                    $emailInfo->getToNames(),
                    $this->getTemplateParams(),
                    $this->getStoreId(),
                    $this->getReplyTo()  //added
            );

As we have passed extra parameter to sendTransactional we have to change that function

First extend Mage_Core_Model_Email_Template in your local module add function

public function sendTransactional($templateId, $sender, $email, $name, $vars=array(), $storeId=null, $reply_to=null) // $reply_to added
    {
        $this->setSentSuccess(false);
        if (($storeId === null) && $this->getDesignConfig()->getStore()) {
            $storeId = $this->getDesignConfig()->getStore();
        }

        if (is_numeric($templateId)) {
            $queue = $this->getQueue();
            $this->load($templateId);
            $this->setQueue($queue);
        } else {
            $localeCode = Mage::getStoreConfig('general/locale/code', $storeId);
            $this->loadDefault($templateId, $localeCode);
        }

        if (!$this->getId()) {
            throw Mage::exception('Mage_Core', Mage::helper('core')->__('Invalid transactional email code: %s', $templateId));
        }

        if (!is_array($sender)) {
            $this->setSenderName(Mage::getStoreConfig('trans_email/ident_' . $sender . '/name', $storeId));
            $this->setSenderEmail(Mage::getStoreConfig('trans_email/ident_' . $sender . '/email', $storeId));
        } else {
            $this->setSenderName($sender['name']);
            $this->setSenderEmail($sender['email']);
        }

        if ($reply_to) { //added
            $this->setSenderName($reply_to);
        }

        if (!isset($vars['store'])) {
            $vars['store'] = Mage::app()->getStore($storeId);
        }
        $this->setSentSuccess($this->send($email, $name, $vars));
        return $this;
    }

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.