I have a server setup to use exim4 and google apps as my smarthost. But I get errors when the to address is not the one I use to authenticate to google and it seems to drop all return addresses that are not the one it uses to authenitcate.

Example: On the contact form of my server a user sets user@company1.com as their return address and uses the form to send a message.

I get an email sent to the admin's address admin@myCompany.com but the return address is also now admin@myCompany.com I have no idea of the return address the user set on the form.

I get around this by putting a bad email address in the form's default so Exim4 sends an error message to admin@myCompany.com with the user's email in the debug info.

Clearly I either have it set up wrong or do not understand how smarthosts work (probably both).

2 Answers 2


If you use Google as a smarthost, they will set the From: address to the address you used to authenticate to Google. They do this on purpose, presumably to prevent spam. If you need a smarthost to forward your mail without altering your headers, I recommend Mailhop Outbound - I used them before and never had any issues...


As the poster mentions above, Google definitely will be restricting the envelope sender and the header From, or else it would lead to widespread abuse.

This problem can solved at a couple of other places, one is your form script, where you can add the form sender in the data itself or else if you want to solve this in exim, I would suggest you write a system filter using the exim filter language which would strip out the From and envelope sender and put in the correct email address for the From and add the form email in a header like X-Form-Submitter-Email.

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.