EanderAlx.org

Linux, Virtualization and whatever I find interesting ...

User Tools


Site Tools



Postfix use with gmx

  • How to use postfix to send mails via a public provider.
  • Here an example with gmx using Ubuntu.

Install

apt-get install postfix libsasl2-modules mailx 

Autoconf

  • When you install postfix a configuration dialog is opened.
  • internet with smarthost
  • mail relay: mail.gmx.net
  • mail name: hostname
  • You can reconfigure postfix:
    dpkg-reconfigure --priority=low postfix

    .

Authentication

  • add to main.cf of postfix

/etc/postfix/main.cf

smtp_sasl_auth_enable = yes
# noplaintext # only wenn you provider doesn't support password encryption :
smtp_sasl_security_options = noanonymous
smtp_sasl_password_maps = hash:/etc/postfix/sasl_password
  • create /etc/postfix/sasl_password
sudo touch /etc/postfix/sasl_password 
  • Enter the necessary authentication informations in the following format “smtp.mailanbieter.de username:securepassword”.
  • Create db file with postmap an then delete plain text file.
sudo postmap /etc/postfix/sasl_password 
rm /etc/postfix/sasl_password
  • restart postfix
/etc/init.d/postfix restart

Correct sender address

  • Most provider check the sender address so you can't send mails under another name.
  • Therefor postfix has to replace the sender address.

etc/postfix/main.cf:

sender_canonical_maps = hash:/etc/postfix/sender_canonical
  • create “/etc/postfix/sender_canonical” as shown below.
user user@gmx.net
www-data user@gmx.net
root user@gmx.net
  • create db file and restart postfix
sudo postmap /etc/postfix/sender_canonical
sudo /etc/init.d/postfix restart   

Aliases

  • Now you need aliases so that postfix know where to send mails to root.

/etc/aliases

root:   user@gmx.net
  • Reload the db file
  • You don't need to restart postfix
newaliases

Test

hostname | mailx -s "root `hostname` `date`" root

Comments

No comments on such a useful post!

This is great, every now and again I keep coming back to this post for reference, it's exactly the information I needed.

Thanks!

1 |
Aaron
| 06.12.2012 14:53 | reply
linux/postfix.txt · Last modified: 23.03.2013 18:41 by eanderalx