User Tools

Site Tools


mail:postfix

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
mail:postfix [2018-12-09 22:40] – old revision restored (2018-12-09 20:44) gabrielmail:postfix [2020-05-31 00:57] (current) – description gabriel
Line 1: Line 1:
 ====== Postfix ====== ====== Postfix ======
  
-Notes on Postfix configuration and tricks.+Notes on Postfix configuration and other silly tricks.
  
 ===== Configuring Postfix with Gmail as an SMTP relay ===== ===== Configuring Postfix with Gmail as an SMTP relay =====
  
 +I currently run my external mail on a Google Apps account.  As a simple solution to allow me to send mail from several Linux systems, I have configured Postfix to use a specially configured Gmail account as a pseudo mail relay.
 +
 +To do this you really only need to make a few configuration changes to the default Postfix main.cf file that ships with the Debian package.
 +
 +<code>
 +# See /usr/share/postfix/main.cf.dist for a commented, more complete version
 +
 +smtpd_banner = $myhostname ESMTP $mail_name (Debian/GNU)
 +biff = no
 +delay_warning_time = 4h
 +readme_directory = no
 +myhostname = localhost
 +alias_maps = hash:/etc/aliases
 +alias_database = hash:/etc/aliases
 +myorigin = $myhostname
 +mydestination = localhost, localhost.localdomain, localhost
 +relayhost = [smtp.gmail.com]:587
 +mynetworks = 127.0.0.0/8
 +mailbox_size_limit = 0
 +recipient_delimiter = +
 +inet_interfaces = loopback-only
 +smtp_sasl_auth_enable = yes
 +smtp_sasl_password_maps = hash:/etc/postfix/sasl/gmail-passwdmap
 +smtp_sasl_security_options = noanonymous
 +smtp_tls_CAfile =  /etc/postfix/gmail-cacerts.pem
 +smtp_use_tls = yes
 +smtp_tls_loglevel=1
 +smtp_tls_security_level=encrypt
 +compatibility_level=2
 +</code>
 +
 +==== Google CA certs ====
 +
 +You can retrieve the current Google CA certs from this page: https://support.google.com/a/answer/6180220?hl=en
 +
 +Store these certs as ''/etc/postfix/gmail-cacerts.pem''.
 +
 +==== Gmail app password ====
 +
 +You will also need to generate an app password to use with the account in Gmail.
 +
 +https://support.google.com/accounts/answer/185833?hl=en
 +
 +You can then configure this username and password in ''/etc/postfix/sasl/gmail-passwdmap'' accordingly:
 +
 +<code>
 +[smtp.gmail.com]:587 my-smtp-relay@example.com:abcdefghijklmnop
 +</code>
 +
 +Where //my-smtp-relay@example.com// is the Gmail account you will use and //abcdefghijklmnop// is your app password.  You will also need to use ''postmap(1)'' to create the Postfix binary map table for this file when you create or modify this file: <code>postmap  /etc/postfix/sasl/gmail-passwdmap</code>
mail/postfix.1544413226.txt.gz · Last modified: 2018-12-09 22:40 by gabriel