I have a Debian Jessie (Version 8.1) server that serves multiple domain names. Each has their own folder configured under /var/www/. Each domain name has a unique conf (example.com.conf) file under /etc/apache2/sites-enabled which is linked to a matching conf file under /etc/apache2/sites-available. Each conf file has:

<VirtualHost *:80>
    ServerAdmin webmaster@localhost
    DocumentRoot /var/www/example_com_dir
    ServerName example.com
    ServerAlias *.example.com

I wanted to be able to accept all emails sent to each of the domains (any email sent to any x@example.com) and forward it to my Gmail. I successfully installed EXIM4 on it, and configured using dpkg-reconfigure exim4-config as follows:

mail sent by smarthost; no local mail
System mail name: myDomainName.TLD
IP-addresses to listen on for incoming SMTP connections: ; ::1
Other destinations for which mail is accepted: <BLANK>
Visible domain name for local users: <BLANK>
IP address or host name of the outgoing smarthost: smtp.gmail.com::587
Keep number of DNS-queries minimal (Dial-on-Demand)? No
Split configuration into small files? No
Root and postmaster mail recipient: <BLANK>

Then I completed all the other steps in this tutorial: https://www.vultr.com/docs/setup-exim-to-send-email-using-gmail-in-debian.

Inside /etc/hosts I have:       localhost       install.install install

# The following lines are desirable for IPv6 capable hosts
::1     localhost ip6-localhost ip6-loopback
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters

Inside /etc/hostname I have one line: example.com

Inside /etc/email-addresses I have:

root: myEmailAddress@gmail.com
info: myEmailAddress@gmail.com
*: myEmailAddress@gmail.com

When I run echo 'Test Message.' | mail -s 'Test Message' example@gmail.com I do get an email in my Gmail. Also, if a run any script from cron.d and it outputs any prints, I do get those as email notifications. So I know outgoing emails work. But when I send an email from example@yahoo.com to root@example.com I do not get any notification in example@gmail.com.

Question #1: I want to be able to get all incoming emails and forward them to somewhere else. For example, I want to send from example@yahoo.com to my domain root@example.com and have the server send it to example@gmail.com. What do I have to configure in order to do so? How can that be configured for a server serving multiple domains?

Question #2: I know it might be opinion based, but what are some of the free, user friendly, with web GUI access email servers that I can configure on Debian Jessie (8.1)?


Reconfigure your config by running

# dpkg-reconfigure exim4-config
  • General type of mail configuration: internet site
  • Other destinations for which mail is accepted: example.com
  • IP-addresses to listen on for incoming SMTP connections: fill in your IP address

Those should be the most important items to change. Remove any smarthost if it's still asked.

Now it should accept incoming SMTP connections (if you entered the IP address correctly), and send email on via the aliases you're already created.

| improve this answer | |

It seems that your mail server is not listening on public address. It is only accepting incoming mail from which is localhost. This explain why sending mail from the server directly using shell command works.

You have to configure it as a public relay host for those specific domains. You have to also update your dns entry accordingly, so that other relays can points to your server when relaying mails to your domains.

Also your part about using google servers is useless. What you did is to configure exim to use google mail service to send mail outside. If well configured it can do it by itself like a real mail server.

| improve this answer | |
  • Can you please example how to do those two things? – KingsInnerSoul Dec 14 '15 at 17:02

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.