Changes

From Amahi Wiki
Jump to: navigation, search
no edit summary
* First of all, install postfix and remove sendmail: <br>
{{Code|<pre>yum -y install postfix mailxyum -y remove sendmail}}</pre>
* 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|Text=<nowikipre>####</nowiki>Gmail SMTP Relay<nowiki>#</nowiki>TLS parameters
smtpd_use_tls=yes
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtp_tls_policy_maps = hash:/etc/postfix/tls_policy
<nowiki>#</nowiki>Relay host configuration
relayhost = [smtp.gmail.com]:587
<nowiki>#</nowiki>SASL Configuration
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtp_sasl_security_options = noanonymous
smtp_sasl_mechanism_filter = plain
smtp_sasl_tls_security_options = noanonymous}}</pre><br />
* Create /etc/postfix/sasl_passwd file with your Gmail login credentials that looks like below:
{{Text|Text=<pre>[smtp.gmail.com]:587 user@gmail.com:Password}}</pre>
<br />
<b>NOTE:</b> Change ''user'' to your username and ''password'' to your gmail crredentials. <br />
* Build the password database: <br>
{{Code|<pre>postmap hash:/etc/postfix/sasl_passwd}}</pre>
* Create /etc/postfix/tls_policy file with your Gmail login credentials that looks like below:
{{Text|Text=<pre>[smtp.gmail.com]:587 encrypt}}</pre>
<br />
* Build the policy database: <br>
{{Code|<pre>postmap /etc/postfix/tls_policy}}</pre>
* Protect the files with your Gmail login data:
{{Code|<pre>chmod 600 /etc/postfix/sasl_passwd
chmod 600 /etc/postfix/sasl_passwd.db
chmod 600 /etc/postfix/tsl_policy
chmod 600 /etc/postfix/tsl_policy.db</pre><!--
chown postfix /etc/postfix/sasl_passwd
chown postfix /etc/postfix/sasl_passwd.db
chown postfix /etc/postfix/tsl_policy
chown postfix /etc/postfix/tsl_policy.db-->}}
* Restart Postfix:
{{Code|<pre>systemctl restart postfix.service}}</pre>
* Set Postifx to start on boot:
{{Code|<pre>systemctl enable postfix.service }}</pre>
* Now try sending a mail, it should reach your Gmail account:
{{Code|<pre>echo test 1 2 <nowiki>|</nowiki> mail -s "Test mail" user@gmail.com}}</pre>
12,424

edits