aschroder / Magento-SMTP-Pro-Email-Extension

Full SMTP and Gmail/Google Apps Email support for Magento
aschroder.com
333 stars 209 forks source link

Any way to set REPLY-TO? #216

Open jrmain opened 7 years ago

jrmain commented 7 years ago

SMTP Pro is working, but replies to mail sent using SMTP Pro are going to the wrong address. I'm using GMail as the mail service, and I understand that the best solution is to switch to a proper mail provider like Mailgun, because GMail overwrites the FROM address with the GMail user's address (https://github.com/aschroder/Magento-SMTP-Pro-Email-Extension/issues/196). And I may end up doing that.

However, if I could set the REPLY-TO address, that would be good enough.

Unfortunately I can't find away way to set REPLY-TO in SMTP Pro's settings.

The SMTP Pro documentation (http://www.aschroder.com/2011/06/smtp-pro-with-magento-a-sort-of-user-guide/) refers to a setting called 'Use Store Email Addresses for Reply-to', but I don't actually see that setting anywhere. Is the documentation somewhat out of date? Was the option removed for some reason?

Someone else asked about this in 2015, but there was no apparent response from the developer: https://github.com/aschroder/Magento-SMTP-Pro-Email-Extension/issues/91

Is there something I'm overlooking?

adarshkhatri commented 6 years ago

Yeah, confirmed, was having same problem when gMail was used.

When I set $mailer->setSender(array('email' => 'myemail@mail.com', 'name' => 'my name')); log shows correct sender name and sender email, however when email received, sender email is always the email that used to authenticate SMTP pro Google Apps Email Address.

PS When I use custom authentication, sender email is correct.

And also, couldn't find 'reply-to' section.

uzegonemad commented 6 years ago

I was able to make this happen by editing https://github.com/aschroder/Magento-SMTP-Pro-Email-Extension/blob/a1f96239937b71cbd23dd161348916c28ffd0b09/app/code/local/Aschroder/SMTPPro/Model/Email/Template.php#L119

Add this line after 119 to set the reply-to

$mail->setReplyTo($this->getSenderEmail(), $this->getSenderName());
adarshkhatri commented 6 years ago

$mail->setFrom($this->getSenderEmail(), $this->getSenderName()); exist in code but still "Sender email" is always the email that used to authenticate SMTP pro.

In order set Reply To, I had to do like this:

              if(Mage::getDesign()->getArea() == 'adminhtml'){ //only can set if email sending from backend
            $mail->setReplyTo($this->getSenderEmail(), $this->getSenderName());
        }
aschroder commented 6 years ago

Friends, I urge you to reconsider this approach. The solution to Gmail not respecting the From: header is not to muck about getting reply-to work, it's to switch to an email service that's designed to do what you are trying to do.

adarshkhatri commented 6 years ago

@aschroder hmm, really didn't quite get you here. What's the solution once again?

FYKI I use gSuite email service.

aschroder commented 6 years ago

Check out proper transactional email services like SendGrid or Mailgun. They'll use whatever From: address header you supply, so you don't need to goof about with reply-to headers.