ubuntu email using smarthost + auth exim/postfix

  • sudo apt-get install exim4 mutt
  • sudo dpkg-reconfigure exim4-config
    • smarthost - no local delivery
    • E-Mail-Name: name of the local machine e.g. 'myLaptop.example.com'
    • incoming connections: 127.0.0.1
    • local domains: empty
    • visible domain name:  'example.com'
    • smarthost: mySmarthost.example.com
    • limit dns: no
    • small config files: yes
  • sudo vi /etc/exim4/passwd.client
    • mySmarthost.example:login:password
  • sudo /etc/init.d/exim4 restart

test:

 

Alternative Postfix:

https://rtcamp.com/tutorials/linux/ubuntu-postfix-gmail-smtp/

  • sudo apt-get install postfix mailutils libsasl2-2 ca-certificates libsasl2-modules
    • Satellite system
    • mypc
  • sudo vi /etc/postfix/main.cf
    • relayhost =  [mymailserver.com]:587

      smtp_use_tls=yes
      smtp_sasl_auth_enable = yes
      smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
      smtp_sasl_security_options = noanonymous
      smtp_tls_CAfile = /etc/postfix/cacert.pem
  • sudo vi /etc/postfix/sasl_passwd
  • sudo chmod 600 /etc/postfix/sasl_passwd
  • sudo postmap /etc/postfix/sasl_passwd
  • cat /etc/ssl/certs/Thawte_Premium_Server_CA.pem | sudo tee -a /etc/postfix/cacert.pem
  • service postfix restart
  • mutt me@example.com
  • tail -f -n 50 /var/log/mail.log

 Rewrite sender address

  • sudo vi /etc/postfix/main.cf
    • mydomain = desired-domain.com
      smtp_generic_maps = hash:/etc/postfix/generic
       
  • vi /etc/postfix/generic
  • postmap /etc/postfix/generic
  • service postfix restart

 or with sender canonical

  • vi /etc/postfix/sender_canonical
  • postmap /etc/postfix/sender_canonical
  • service postfix restart