Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Let's say I have domain.com , domain2.com, domain3.com on same VPS and all of them send mail, but Helo of all messages from all domains is localhost which gets rejected by some mail providers. How to make exim4 set helo to domain name from where it's sending mail. Like if I'm sending mail from domain.com helo should be domain.com. Other question, is this right thing to do?

UPD I changed my mind. I just want to set it to FQDN of box.

share|improve this question
    
The easy way would probably be to just tell Exim to identify as whatever your canonical host name is. That's how most mail servers do it. –  Michael Kjörling Nov 27 '12 at 14:04
    
And how to do that? –  Flyer Nov 27 '12 at 14:15

2 Answers 2

The "proper" way to do this would be to set Exim's "primary host name" to whatever the fully qualified, canonical name of your host is. Few remote mail servers will even begin to care about the domain part in the From: header of the mail, and most don't give the domain part of the envelope-sender a second glance either if it passes such things as SPF validation.

The exact steps for doing this would depend on your installation, but it looks like simply setting Exim's primary_hostname configuration variable to a FQDN that resolves back to your host's public IP address will do nicely.

You may find http://www.exim.org/exim-html-current/doc/html/spec_html/ch07.html to be helpful.

share|improve this answer
    
well, it seems some like gmx.net, mail.com, web.de indeed look at that and reject mail. I believe this system uses 'split configuration' for exim (few folders in conf.d, each have few files inside) and i don't know where to find primary_hostname parameter, in which file I mean –  Flyer Nov 27 '12 at 14:36
    
In that case, I would recommend reading up on Exim's configuration structure. Since you haven't actually specified your environment, it's impossible for anyone to provide blow-by-blow descriptions (which, also, is not really what serverfault.SE is for). –  Michael Kjörling Nov 27 '12 at 14:39
    
What information should I provide then? –  Flyer Nov 27 '12 at 16:33
    
Debian configuration style info is located at: pkg-exim4.alioth.debian.org/README/README.Debian.etch.html. It is also possible that those major providers are rejecting that mail based primarily on the IP address you are sending from. They all use reputation based systems, such that initial emails (with zero reputation or bad reputation neighbors) are more likely to get rejected. You have not provided us enough info to determine that. –  Todd Lyons Nov 27 '12 at 19:02
    
No, it rejects because of helo and message returned clearly says that –  Flyer Nov 27 '12 at 20:00

The smtp transport has a helo_data setting. By default it is set to $primary_hostname, which is why the first person's advice would work just fine if you wanted to configure the primary_hostname setting to a single, valid hostname. Since you seem to want to make it HELO with a dynamic hostname, you have to add a little logic to figure out which name it should use.

Somewhere in your DATA acl, you could detect those specific domains and set a variable. This is a very simple example (you could enhance by using file or database lookups) :

warn  domains      = domain1.com : domain2.com : domain3.com
      set acl_m_special_dom = mail.$domain

Look in your logs to determine which smtp transport is being used to send this email. Edit that transport and add a helo_data line that examines that acl message variable and adjusts the hostname that exim will use to HELO/EHLO with:

helo_data = ${if eq{$acl_m_special_dom}{}  \
                     {$primary_hostname}   \
                     {$acl_m_special_dom} }

The test checks if the variable is empty. If it's empty, it will use $primary_hostname. But if it is not empty, then it must have been set in the ACL condition above so it uses that hostname in the EHLO. This variable is a per message variable, so it gets cleared inbetween each message (if multiple messages are coming down in one connection).

You must make sure that any hostname you use here is resolvable in public DNS (test using Google's DNS), and that the IP it resolves too also has a reverse DNS. The rDNS does not need to match the hostname you use, but it needs to resolve to something. And if it reverse resolves to something that looks dynamic like a cablemodem or dsl line, it will likely still get blocked or deferred by most major mail providers.

Back to your description, it sounds like you are using the Debian split configuration system. They have a macro that will vary the HELO hostname based on the sender IP address that connects to your exim server. This will not work for you though if your email is sourced from one common server, meaning you need to vary this HELO hostname based on the sender domain name as shown above.

share|improve this answer
    
I changed my mind. I just want to set it to valid hostname, but doing search though files I only found primary_hostname = MAIN_HARDCODE_PRIMARY_HOSTNAME. So how do I put valid hostname in MAIN_HARDCODE_PRIMARY_HOSTNAME? Or I just add line primary_hostname = Desired hostname? –  Flyer Nov 27 '12 at 20:09
1  
Run 'dpkg-reconfigure exim4-config'. The second question it asks you is what hostname you want it to use. Behind the scenes, it is just updating the /etc/mailname file with that hostname and rewriting the /var/lib/exim4/config.autogenerated file (which is what exim4 actually uses for its config file). –  Todd Lyons Nov 27 '12 at 20:28
    
Oks, no, how do I check helo? :o I looked at headers Received: from LulzServer (name from hostname file. [IP]). LulzServer is from hosts file, which is IP LulzServer 127.0.0.1 LulzServer localhost localhost.localdomain localhost4 localhost4.localdomain4 ::1 LulzServer localhost localhost.localdomain localhost6 localhost6.localdomain6 –  Flyer Nov 27 '12 at 21:19

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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