How to remove "via" from email From header?

My droplet (Ubuntu 14.04) is hosting multiple websites using Apache virtual hosts. I have send-only Exim4 installed (for website contact forms, admin emails etc.) and I’ve set up SPF and DKIM records. Emails from all the websites are verified and do not end up with any flags or go into spam. Awesome!

However, emails from all websites except my main website (the one my droplet is named after) arrive with “From: Name <> via”.

How can I get rid of “via”?

My /etc/exim4/conf.d/transport/30_exim4-config_remote_smtp contains the following:

DKIM_DOMAIN = ${lc:${domain:$h_from:}}
DKIM_PRIVATE_KEY = /etc/exim4/dkim/{DKIM_DOMAIN}.pem
DKIM_CANON = relaxed

In other words, all my websites are using the same DKIM keys. But that shouldn’t make a difference, right?

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

Hi @jpgklassen

To answer you question: So it sounds to me that there’s no way for me to have multiple websites sending emails from multiple domains on the same server, without getting the “via”

Yes, follow what I’ve written in the first answer - add the PHP value. I’m running several servers with many websites on each server and all of them are setup like this.

Hi @jpgklassen

Looks like a good Exim setup. It has nothing to do with DKIM - not in this case.

I’m guessing you’re using PHP. You need to change the MAILFROM address, so it doesn’t automatically use your domain. I don’t know Exim, but I think it’s a drop-in-replacement of Sendmail just like Postfix is.

You can modify the php.ini for each domain, or simply add the following to the root .htaccess file (there is a space after the -i in the end):

php_value sendmail_path /usr/sbin/sendmail -t -f -i