Mail Transfer Agent:
A mail server (also known as a mail transfer agent or MTA, a mail transport agent, a mail router or an Internet mailer) is an application that receives incoming e-mail from local users (people within the same domain) and remote senders and forwards outgoing e-mail for delivery. A computer dedicated to running such applications is also called a mail server. The default MTA in Ubuntu is Postfix, but exim4 is also fully supported and in the main repository.
Exim Transfer Agent:
Exim is a message transfer agent (MTA) developed at the University of Cambridge for use on Unix systems connected to the Internet. It is freely available under the terms of the GNU General Public Licence. In style it is similar to Smail 3, but its facilities are more general. There is a great deal of flexibility in the way mail can be routed, and there are extensive facilities for checking incoming mail. Exim can be installed in place of Sendmail, although the configuration of Exim is quite different.
Step 1. First install the Postfix package-exim4 from the Main repository as :
apt-get install exim4 exim4-config
Step 2. Configuration: From terminal prompt ,run following command:
You will see the ‘Package Configuration’ interface. Here, select the options as mentioned in the following:
- Choose : mail sent by smarthost; received via SMTP or fetchmail
- Type System Mail Name: e.g. company.com
- Type IP Adresses to listen on for incoming SMTP connections: 127.0.0.1
- Leave Other destinations for which mail is accepted blank
- Leave Machines to relay mail for: blank
- Type Machine handling outgoing mail for this host (smarthost): smtp.gmail.com::587
- Choose NO, don’t hide local mail name in outgoing mail.
- Chose NO, don’t keep number of DNS-queries minimal (Dial-on-Demand).
- Choose mbox
- Choose NO, split configuration into small files
- Mail for postmaster. Leaving blank will not cause any problems though it is not recommended
Step 3: Open the file /etc/exim4/exim4.conf.template by
sudo gedit /etc/exim4/exim4.conf.template
Find the line .ifdef DCconfig_smarthost DCconfig_satelliteand add the following in that section
send_via_gmail: driver = manualroute domains = ! +local_domains transport = gmail_smtp route_list = * smtp.gmail.com
If you have any other smarthost defined with “domains = ! +local_domains” remove that smarthost.
- Find the “begin authenticators”. In that section add the following
gmail_login: driver = plaintext public_name = LOGIN client_send = : email@example.com : YourGmailPassword
Make sure you have no other authenticators with the same public_name (LOGIN).
- Comment out the whole sectionin the bottom starting with:login:
driver = plaintext
public_name = LOGIN
Starting fro login upto end, comment the whole file.
- Find the comment “transport/30_exim4-config_remote_smtp_smarthost”. In that section add
gmail_smtp: driver = smtp port = 587 hosts_require_auth = $host_address hosts_require_tls = $host_address
- Step 4:
- Run update-exim4.conf
- Do /etc/init.d/exim4 restart
That should be it. You can test by using the command line mail client.
- Run mail firstname.lastname@example.org
- Give a subject and press enter
- Type something and press enter
- Type a single . (dot) and press enter
- Press enter for a blank CC:
This was on an Ubuntu server. And all is done !