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 😉
First of all install the following packages in this exact same order. Otherwise it could fail.
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.
Add the following lines and save the file
Change firstname.lastname@example.org:password with your e-mail and password.
TIP: You can edit the file using sado nano /etc/exim4/passwd.client
That’s all !
You should be able to send e-mails using PHP for example:
mail('email@example.com', 'Subject', 'This is the message');