-1

Is this possible?

The reason I ask this is because Gmail keeps attaching the 'via' field in the email messages originated from one of my sites that resides in a server with the hostname of a whole different domain.

Besides moving this site to its own server, is there any other way to get rid of the 'via' field? After researching for a bit, I find the only solution is to give the server the hostname of the domain that sends the email. But it would be bad to remove the current hostname. Here goes the question.

Is this possible for Linux to have multiple hostnames?

datasn.io
  • 279
  • 1
  • 5
  • 16
  • 1
    It's normally buried in the server MTA config (i.e. which email domain to use) and by default is often the FQ hostname of the server running your website. But you haven't told us anything about your server. Is it hosted? your own VPS...what? – hookenz Oct 31 '12 at 01:10
  • Please reword your question. Apache has nothing to do with email and there is no reason to even mention it. If *you* don't understand what you're asking you can't really expect good answers. – John Gardeniers Oct 31 '12 at 02:01
  • Thank you both for the comments and interests in my question. As John pointed out, I didn't ask it quite the right way but was lucky enough to get an answer anyway. Thanks everyone again! – datasn.io Oct 31 '12 at 02:50

3 Answers3

3

Gmail displays the "via" domain when it thinks that the mail has not been sent by an authorised MTA for that domain. To prevent this being displayed you need to configure SPF and DKIM to authorise your mail server for that domain.

Edit: From the page you linked:

In cases where there was any domain match between the visible from: and the return path, either the exact domain or a subdomain, there was no “via” displayed, even if authentication failed.

Only when there is a domain mis-match and failing authentication is a via displayed.

So you need to make your Return-Path use the same domain as the From header. The Return-Path is determined by the envelope from address specified by the originating SMTP client.

mgorven
  • 30,615
  • 7
  • 79
  • 122
  • Thanks for the tips but I have tried it all. SPF and DKIM only seem to help identify your messages as legal ones (NOT spam) so they aren't caught in the spam folder. But it still displays a 'via' field. Check this: http://blog.wordtothewise.com/2012/04/getting-rid-of-the-via-at-gmail/ – datasn.io Oct 31 '12 at 00:46
  • @kavoir.com Edited answer. – mgorven Oct 31 '12 at 01:01
  • That's the answer! Thank you! I didn't quite follow what a return path was....For PHP mail(), just add a 5th parameter as '-fsystem@mydomain.com' for system@mydomain.com to be the Return-Path email - http://php.net/manual/en/function.mail.php – datasn.io Oct 31 '12 at 02:01
1

In /etc/hosts you can define multiple hostname for the machine like:

192.168.0.1 host1.domainl host2.domain2 host1 host2

The machine will answer to all these hostnames on IP 192.168.0.1.

Obs: you can do the same for 127.0.0.1 or any other IP you want your machine to answer too. (multiple IP too if the machine has multiple IP assigned).

laurent
  • 2,055
  • 16
  • 14
  • Thanks that seems to be it. However I'm using WHM/cPanel on my host and it keeps updating /etc/hosts with a single hostname. And there doesn't seem to be any way to add multiple hostnames via WHM/cPanel......what do I do? – datasn.io Oct 31 '12 at 01:31
  • Sorry, no idea, I never worked with cPanel... – laurent Oct 31 '12 at 02:33
-1

You can add a servername in the virtual hosts.

<VirtualHost *:80>
DocumentRoot /www/example1
ServerName www.example.com
Jeroen
  • 1,341
  • 7
  • 16
  • Is that the same as a hostname? I'm not an expert of Linux but I suppose hostname is more a system thing rather than an Apache thing? Probably in /etc/hosts or something? – datasn.io Oct 30 '12 at 13:51
  • Had you read the question you would know that the OP is asking with respect to email, not web hosting. Admittedly, it is a very confused and convoluted question. – John Gardeniers Oct 31 '12 at 01:59