User Tools

Site Tools


linux:postfix

Differences

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

Link to this comparison view

Next revision
Previous revision
linux:postfix [2017/03/10 19:08]
rlunaro created
linux:postfix [2017/03/12 15:37] (current)
rlunaro
Line 12: Line 12:
 <code> <code>
 sudo apt-get install postfix  sudo apt-get install postfix 
 +sudo apt-get install mailutils
 </code> </code>
  
Line 20: Line 21:
 <code> <code>
 cp /usr/share/postfix/main.cf.debian /etc/postfix/main.cf cp /usr/share/postfix/main.cf.debian /etc/postfix/main.cf
 +</code>
 +
 +This is my configuration for a host that it is isolated in internet, and 
 +it has no special needs (it is not the mail server for any domain, it only 
 +needs to send some emails): 
 +
 +<code>
 +# See /usr/share/postfix/main.cf.dist for a commented, more complete version
 +
 +
 +mail_owner = postfix
 +
 +# Debian specific:  Specifying a file name will cause the first
 +# line of that file to be used as the name.  The Debian default
 +# is /etc/mailname.
 +myhostname = cloud.mister-i.com
 +
 +mydomain = mister-i.com
 +
 +myorigin = $myhostname
 +
 +mydestination = $myhostname, localhost, novaprime
 +
 +mynetworks_style = host
 +
 +relay_domains = $mydestination
 +
 +smtp_generic_maps = hash:/etc/postfix/generic
 +
 +smtpd_banner = $myhostname ESMTP $mail_name
 +biff = no
 +
 +# appending .domain is the MUA's job.
 +append_dot_mydomain = no
 +
 +# Uncomment the next line to generate "delayed mail" warnings
 +#delay_warning_time = 4h
 +
 +readme_directory = no
 +compatibility_level = 2
 +
 +inet_interfaces = all
 +inet_protocols = all
 +
 +smtpd_use_tls = no
 +smtp_use_tls = no 
 +
 +
 +</code>
 +
 +
 +It's very important to configure the file ''/etc/postfix/generic'' with a remapping of the local 
 +users to complete email addresses: 
 +
 +<code>
 +# REMEMBER!!!! After making changes to this file you must run: 
 +#
 +# postmap /etc/postfix/generic
 +#
 +#
 +
 +username   username@complete.server.address.com
 +</code>
 +
 +In that way, every outgoing email is rewrited from username@localhost to username@complete.server.address.com and nowadays email servers can recognize it as a valid email 
 +address. 
 +
 +After that **don't forget to run postmap /etc/postfix/generic** in order to update the database with the fresh configuration.
 +
 +==== Open firewall ====
 +
 +
 +<code>
 +ufw allow 25
 +</code>
 +
 +http://serverfault.com/questions/149903/what-ports-to-open-for-mail-server
 +
 +==== Do some testing ====
 +
 +
 +<code>
 +mail --subject="hello from server" destination-address@example.com
 </code> </code>
  
linux/postfix.1489169281.txt.gz ยท Last modified: 2017/03/10 19:08 by rlunaro