I added a second domain to my web server. I had my hosting company assist with postfix configuration. Since then I am able to send email from the command line using php:

php -r 'mail("destination@mycompany.tld", "Test Subject", "Test Message", "-f sales@secondarywebsite.tld");'

When I use the above to send email to either Outlook and Gmail, everything is perfect, so long as I include the "-f sales@secondarywebsite.tld". Email from Magento, on the other hand, shows me the email is "sent by/via" sales=secondarywebsite.tld@mainwebsite.tld.

Since as far as I know Magento is using the php mail command, why am I not getting the correct from address? What can I do to fix this? This seems like it would be a very common problem to have, I would think there is some sort of setting in Magento I'm missing.


I take it from the lack of response this probably isn't possible to do with standalone Magento.

In order to send from the correct domain, I made a plugin using this WebKul tutorial as suggested in a similar question.

The complete module goes a bit beyond the tutorial by creating a settings page in Magento where you can enter smtp info.

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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