Configure Postfix to Relay on Gmail to Send Emails

Written by
Date: 2012-03-16 22:11:00 00:00

Because of my implementation of static comments on this blog, and because of my need that all these comments should be sent to me via email.

I needed an email server on my Linux, where I run Nginx.

I decided to install postfix

pacman -S postfix

In my Arch Linux server.

But to send emails from a "personal" computer now a days is not an easy task, and some of the emails may be rejected, because my, IP does not have a reverse DNS record, and some other issues. Because of that, I decided to make postfix relay on Gmail, to send my emails.

The configuration is really simple, and all I've done is to follow the same steps I did when configuring Postfix to relay on Gmail on my Mac

The only different step I did wast to add postfix to the /etc/rc.conf file in the daemons line. Mine looks something like this:

Also be sure to add this line to the /etc/postfix/mail.rc

inet_interfaces = localhost

This will deny any incoming connection to postfix if it is not from the localhost.

I did that because I do not want to make my server an open relay smtp server, which is a really bad idea.

That configuration can be used also to have your own local SMTP server on your Linux laptop.