Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to set up Exim to send the mails through my gmail (actually my domains google apps).

I have added the router, transport and authenticator. Specifically:

  driver = manualroute
  transport = gmail_relay
  route_list = *

  driver = smtp
  port = 587
  hosts_require_auth = $host_address
  hosts_require_tls = $host_address

  driver = plaintext
  public_name = LOGIN
  hide client_send =

I was able to set this up for Exim on Debian but I can't figure it out on Centos.

When I try and send while monitoring the logs it tells me "no IP address found..." and then "SMTP error from remote mail server...". It also says "Authentication required".

Here is more detail: Pretend I am sending to R=gmail_route T=gmail_relay: SMTP error from remote mail server after MAIL FROM:<> SIZE=1492: 

host [2a00:1450:4001:c02::6d]: 

530-5.5.1 Authentication Required. Learn more at\n530 5.5.1 k41sm12066343een.19 - gsmtp

Is there anything I can try to fix this? I am planning on using it mostly to send alert emails to myself (fail2ban, logwatch etc). And the default Exim setup seems to work but I would prefer to use my gapps email like - For one thing the emails went to spam before I trained my email account to put them in the inbox...


share|improve this question

I have used the following config


   driver = manualroute
   domains = ! +local_domains
   transport = gmail_smtp
   route_list = *


   driver = smtp
   port = 587
   hosts_require_auth = $host_address
   hosts_require_tls = $host_address


   driver = plaintext
   public_name = LOGIN
   client_send = : : 7654321

Some simple test

# swaks -s --to --from
=== Trying
=== Connected to
<-  220, []
 -> EHLO
<- Hello localhost []
<-  250-SIZE 52428800
<-  250-STARTTLS
<-  250 HELP
 -> MAIL FROM:<>
<-  250 OK
 -> RCPT TO:<>
<-  250 Accepted
 -> DATA
<-  354 Enter message, ending with "." on a line by itself
 -> Date: Wed, 05 Mar 2014 10:22:55 -0500
 -> To:
 -> From:
 -> Subject: test Wed, 05 Mar 2014 10:22:55 -0500
 -> X-Mailer: swaks v20130209.0
 -> This is a test mailing
 -> .
<-  250 OK id=1WLDep-0004ED-Kb
 -> QUIT
<-  221 closing connection
=== Connection closed with remote host.

Check maillog file

# cat /var/log/exim/main.log | grep 1WLDep-0004ED-Kb
2014-03-05 10:22:55 1WLDep-0004ED-Kb <= H=localhost ( [] P=esmtp S=479
2014-03-05 10:22:55 1WLDep-0004ED-Kb [2a00:1450:4001:c02::6d] Network is unreachable
2014-03-05 10:23:00 1WLDep-0004ED-Kb => R=send_via_gmail T=gmail_smtp [] X=UNKNOWN:ECDHE-RSA-AES128-GCM-SHA256:128
2014-03-05 10:23:00 1WLDep-0004ED-Kb Completed

You can run exim in debug mode

# echo -e "helo localhost\nmail from:<>\nrcpt to:<>\nDATA\nHello world\n.\nquit" | exim -bhc -d+all

After that you get a lot of data. Add the output to the question

share|improve this answer
No matter how I tweak it, it still gives me an smtp error... – Jay Mar 6 '14 at 16:23
I have updated my answer – ALex_hha Mar 6 '14 at 17:10

Did you tried this;

Using GMail as smarthost:

Note: The following must be put in the appropriate sections of the configuration file, eg, after begin authenticators.

Add a router before or instead of the dnslookup router:

gmail_route: driver = manualroute transport = gmail_relay route_list = *

Add a transport:

gmail_relay: driver = smtp port = 587 hosts_require_auth = $host_address hosts_require_tls = $host_address

Add an authenticator (replacing and mypassword with your own account details):

gmail_login: driver = plaintext public_name = LOGIN hide client_send = : : mypassword

$host_address is used for hosts_require_auth and hosts_require_tls instead of to avoid occasional 530 5.5.1 Authentication Required errors. These are caused by the changing IP addresses in DNS queries for $host_address will expand to the particular IP address that was resolved by the gmail_route router. For added security, use a per-application password. This works with Google Apps accounts as well.


share|improve this answer

You need to change your hosts_require_auth and hosts_require_tls options to the following:

  hosts_require_auth = <; $host_address
  hosts_require_tls = <; $host_address

The problem will occur when using IPv6 to send. When sending with IPv6, $host_address will be an IPv6 address and will therefore contain colon characters (:). Colon is usually used as a list separator in Exim, so the address matching fails and Exim won't authenticate itself.

Prefixing the lists with <; changes the list separator character to a semi-colon and prevents the problem with IPv6 addresses.

share|improve this answer

Your Answer


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.