Outgoing mail via gmail
From Amahi
tags: mail gmail f14 postfix relay
| WARNING | |
|---|---|
| This is recommended only for advanced users, proceed with caution. |
This can be used to send mails from your HDA and to receive system emails.
To receive emails meant for the root user, you have to Forward System Emails after finishing this.
I took the information from this page and modified them slightly for Fedora 14 / Amahi 6.
First of all, install postfix and remove sendmail:
| bash code |
|---|
| yum -y install postfix yum -y remove sendmail |
Openssl and openssl-perl are needed to generate certificates and create SSL connections to GMail
Openssl should be installed already, but to be sure:
| bash code |
|---|
| yum -y install openssl openssl-perl |
A Certificate Authority is needed to create the necessary certificates. You can skip the next paragraph if you already have one:
| bash code |
|---|
| cd /etc/pki/tls/misc ./CA –newca |
- You will be prompted for the file name, hit enter to create a new CA.
- You will need to enter a passphrase next, be sure to remember it.
- Choose the Country Name, State or Province Name, Locality Name, Organization Name, and Organizational Unit Name to your liking. Be sure to remember the values, they will be needed in the key creation later.
- For the Common Name, type “CA” (without quotes).
- Take defaults for everything else and when prompted enter the passphrase from above.
Now a key that is sent to Gmail to start the SSL encryption will be created:
| bash code |
|---|
| cd /etc/pki/tls mkdir gmail_relay |
You will be prompted for country etc. like when creating the CA. Enter the same values.
As Common Name, now enter the name of your server, FQDN or not, your choice.
| bash code |
|---|
| openssl ca -out server.pem -infiles server.csr |
You will need to enter your passphrase again at this point.
When asked if you want to sign the key, answer yes, same when asked if to commit it.
Add the following to the bottom of the file /etc/postfix/main.cf. You do not need to change anything else in it, as the last setting for any option is the one that is saved.
| Text |
|---|
| #### Gmail SSL SMTP Relay relayhost = [smtp.gmail.com]:587 |
Create /etc/postfix/sasl_passwd file with your Gmail login credentials that looks like below:
| Text |
|---|
| gmail-smtp.l.google.com user@gmail.com:password smtp.gmail.com user@gmail.com:password |
Obviously, you need to change user to your username and password to your gmail password.
Create the password database:
| bash code |
|---|
| postmap hash:/etc/postfix/sasl_passwd |
Protect the files with your Gmail login data:
| bash code |
|---|
| chmod 600 /etc/postfix/sasl_passwd chmod 600 /etc/postfix/sasl_passwd.db |
Restart Postfix:
| bash code |
|---|
| /etc/init.d/postfix restart |
Set Postifx to start on boot:
| bash code |
|---|
| chkconfig postfix on |
Now try sending a mail, it should reach your Gmail account:
| bash code |
|---|
| echo test 1 2 | mail -s "Test mail" user@gmail.com |
See also:
Amahi Mail - The Free Way, not working on F14, yet.
Forward System Emails
Enable Outgoing Emails, not working on F14, yet.
Monitor System Logs via E-mail
