I have a Debian Jessie server running Exim 4, with GMail setup as the Smarthost. If I try to send mail with an external address (i.e. CanadianLuke@example.com), it works fine. If I send mail to root or canadianluke (local usernames), I get two messages: the message I sent, and an email that GMail automatically generates, saying that it can't deliver mail to root@empty. We are using Google Apps for Non-Profits.

The email comes through, so I know that it's not fully Exim4, but I'm not entirely convinced that it's entirely GMail.

The command I'm using to send emails on my terminal: mail root -s Test

Delivery to the following recipient failed permanently:


Technical details of permanent failure:
DNS Error: Address resolution of empty. failed: Domain name not found

----- Original message -----

DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=MYDOMAIN_COM.20150623.gappssmtp.com; s=20150623;
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20130820;
X-Gm-Message-State: ALoCoQn4f0bfvp6Tk6pmiVZgxHs/bn8OVKale7+375O8j9UzvWgsYVSltXGIbvQQk5Fxi3DKGh5o
X-Received: by with SMTP id f107mr417247qge.0.1447108430809;
        Mon, 09 Nov 2015 14:33:50 -0800 (PST)
Return-Path: <CanadianLuke@example.com>
Received: from example.com ([])
        by smtp.gmail.com with ESMTPSA id 83sm102514qhw.27.2015.
        for <root@empty>
        (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
        Mon, 09 Nov 2015 14:33:50 -0800 (PST)
From: root <CanadianLuke@example.com>
X-Google-Original-From: root <root@empty>
Received: from root by example.com with local (Exim 4.84)
        (envelope-from <root@empty>)
        id 1Zvv0W-0006Lj-Tf
        for root@empty; Mon, 09 Nov 2015 17:33:48 -0500
To: root@empty
Subject: Sup
Message-Id: <E1Zvv0W-0006Lj-Tf@example.com>
Date: Mon, 09 Nov 2015 17:33:48 -0500

Update. I got it to send mail again, but it's giving a new error. I added my username into /etc/aliases for where to send mail as root, and /etc/email-addresses is set to send mail destined for me to my regular email account (CanadianLuke@example.com).

# more exim4/update-exim4.conf.conf

Now, the email is showing as an error from root@server.example.com, still the same DNS error: Address resolution of server.example.com failed: Domain name not found in Google Apps.

Below is a tail of my /var/log/exim4/mainlog, showing mail is in fact leaving the server:

2015-11-12 07:01:01 1ZwqYn-0001oN-2H <= canadianluke@example.com U=root P=local S=2598
2015-11-12 07:01:01 1ZwqYn-0001oN-2H gmail-smtp-msa.l.google.com [2607:f8b0:400c:c06::6d] Network is unreachable
2015-11-12 07:01:02 1ZwqYn-0001oN-2H => root@server.example.com R=smarthost T=remote_smtp_smarthost H=gmail-smtp-msa.l.google.com [] X=TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128 DN="C=US,ST=California,L=Mountain View,O=Google Inc,CN=smtp.gmail.com" A=plain C="250 2.0.0 OK 1447329663 h144sm1989632vke.26 - gsmtp"
2015-11-12 07:01:02 1ZwqYn-0001oN-2H Completed

My /etc/aliases file:

# /etc/aliases
mailer-daemon: postmaster
postmaster: root
nobody: root
hostmaster: root
usenet: root
news: root
webmaster: root
www: root
ftp: root
abuse: root
noc: root
security: root
root: canadianluke
canadianluke: canadianluke@example.com
  • Please see my updated answer, I hope that helps. – aseq Nov 11 '15 at 3:17

The email address root@empty is not a valid email address. The remote server is correct in returning an error email.

An email address generally needs to consist of three parts, separated by the at sign <@> and a dot <.>

The first part typically is some form of a user name, but could also be a function (sales, hr), or anything really (as long as your MTA knows what to do with it), the second part right after at sign <@> is the domain name and the last part right after the dot <.> is the TLD or top level domain. These can not be arbitrary for obvious reasons.


The MTA does not know where to send your email with address root@empty.

This might work on a local system when the MTA knows what to do with email addresses of that particular format, but once it leaves your local system it's just going to be refused and you get an error back.

What you need to do is to configure exim to either deliver emails with the format name@example (where example is your own domain) locally and not try to send them out, or configure exim to rewrite such emails with the correct format name@example.com and then send them out.

When you run dpkg-reconfigure exim4-config there is a question Other destinations for which mail is accepted: if there you add the domain(s) for which you want the system to be the final destination what you're trying to do should work. But you may do some hand editing of the configuration files.

Since you say you actually receive the email and get an error from the remote MTA you may just have to reconfigure exim to not send such emails out. The above I think might take care of that automagically.

Also see:



Update: Judging from your updated question it appears you either need to use the email address in the form of user@example.com or register server.example.com at google apps. I forgot exactly how to do this but I know it is possible to configure this. Of course make sure the DNS for server.example.com is set up correctly.

Regarding your last comment, did you try to add the following line into /etc/aliases

root: root@example.com

This would automatically tell exim to redirect mail destined to the root account on that system to be sent to root@example.com (or even root@server.example.com if you configured that in aliases).

| improve this answer | |
  • I changed the option, but now mail does not get received at all. I also tried changing the host name (as I want all email to actually just get forwarded to Google Apps for my domain), so I changed the Final Destination to server.example.com, which doesn't actually exist – Canadian Luke Nov 10 '15 at 2:47
  • I just want the root account to automatically forward to the company email I have, hosted by Google. No other email addresses should be on this server. In all my other servers, I can just type mail root and a message gets sent, without warning back from Google Mail saying it can't find the return address. I'm really hoping this is possible still, but I'm running out of ideas – Canadian Luke Nov 11 '15 at 4:06
  • Updated my answer suggesting /etc/aliases file. – aseq Nov 12 '15 at 23:48
  • Updated the question to include /etc/aliases – Canadian Luke Nov 12 '15 at 23:51

You need to configure exim to add your domain to unqualified sender and recipient addresses ("unqualified" meaning "that do not already have a domain").

In pure exim, that would be "qualify_domain". Since you are using debconf, I think setting the contents of /etc/mailname to your domain should work.

Then you have the problem that the usernames of users sending mail to the outside should correspond to real addresses. Your "root" user will be sending mail, where do you want it to go? A usual solution is to say that the server receives mail for itself and itself only (myserver.example.com). That way system-generated mail stays on the server. For mail to the outside, force source e-mail addresses either using the MUA or the MTA. For Exim (MTA), it's called sender rewriting, you want something like

begin rewrite
^mylogin@myserver$ my@email SFf`
| improve this answer | |
  • This helped, slightly. I'm still getting the error email back from Google Apps. I updated my question – Canadian Luke Nov 11 '15 at 0:10
  • Please show the mail log (/probably /var/log/exim/main.log). The problem seems to be that google sees server.example.com, which doesn't exist. Since you want root mail to go out, you need to hide the server name from google, and just have the domain name. – Law29 Nov 12 '15 at 9:41
  • Updated the question with my mainlog – Canadian Luke Nov 12 '15 at 23:43
  • OK! In your log you can see that the source address is (now) good, it is canadianluke@example.com, but the destination address is not, it is root@server.example.com and it should be an address that is valid. So it's not source rewriting you want, but destination rewriting. I am not sure that your server is looking at /etc/aliases, because it is configured with "no local mail". – Law29 Nov 13 '15 at 13:11

I figured out the root cause was thanks to @aseq's answer above, but I figured out how to get it to not send the extra mail message from the Google Postmaster.

I had followed a tutorial for setting up GMail Authentication up with Exim4 on Debian, and it asked me to "[c]hoose "mail sent by smarthost; received via SMTP or fetchmail". This caused Exim to expect local accounts to send mail with as well, but all I wanted was messages sent to my main email.

This is a classic example of the XY problem that I should have been more aware of. I fixed the underlying issue by setting exim4 to mail sent by smarthost; no local mail on the first screen of its dpkg-reconfigure exim4-config. Restarted Exim4's service, and mail worked properly!

| improve this answer | |
  • Glad it's working now, +1 for the insightful answer. :-) – aseq Nov 18 '15 at 3:31

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.