Setup exim4 to use Gmail in Ubuntu
Alright, we’re now going to configure exim4 to use our Gmail account as SMTP Server.
In fact it’s easier than how it sounds
Install exim4
First of all install the following packages in this exact same order. Otherwise it could fail.
sudo apt-get install exim4-base exim4-config
sudo apt-get install exim4-daemon-light
sudo dpkg-reconfigure exim4-config
sudo apt-get install exim4-daemon-light
sudo dpkg-reconfigure exim4-config
The setup will be prompted. Configure as follows
The last command should have prompted a configuration screen. Configure it like this:
- General type of mail configuration: mail sent by smarthost; no local mail
- System mail name: (default)
- IP-addresses to listen on for incoming SMTP connections: 127.0.0.1
- Other destinations for which mail is accepted: (default)
- Visible domain name for local users: yourdomain.com
- 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
Here’s the same configuration but through screenshots. You can skip this and go to the next step if you want.
Create a file
We’re now going to create the file with our Google Account credentials.
sudo touch /etc/exim4/passwd.client
Add the following lines and save the file
Change your_email@gmail.com:password with your e-mail and password.
gmail-smtp.l.google.com:your_email@gmail.com:password
*.google.com:your_email@gmail.com:password
smtp.gmail.com:your_email@gmail.com:password
*.google.com:your_email@gmail.com:password
smtp.gmail.com:your_email@gmail.com:password
TIP: You can edit the file using sado nano /etc/exim4/passwd.client
Reload exim4
sudo /etc/init.d/exim4 reload
That’s all !
You should be able to send e-mails using PHP for example:
<?php
mail('example@domain.com', 'Subject', 'This is the message');
?>
mail('example@domain.com', 'Subject', 'This is the message');
?>








No comments yet.