Install postfix to relay email

Hi,

I wanted to set email aliases like titouan13@mydomain.com to be resent to my personal email address. In order to do so, I installed postfix.


I used a lot this great tutorial: https://wiki.debian.org/Postfix

Here is the configuration of my MX server:
Mydomain.com 3600 IN MX 10 mail.Mydomain.com.
Mydomain.com 3600 IN SPF “v=spf1 mx -all”
Mydomain.com 3600 IN TXT “v=spf1 mx -all”

Don’t forget to add A and AAAA fields (for IP V4 and IP V6). mail.mydomain.com is pointing at my ip address.

Here are my source.

main.cf

smtpd_banner = $myhostname ESMTP $mail_name (Debian/GNU)
biff = no

# appending .domain is the MUA's job.
append_dot_mydomain = no

readme_directory = no

# TLS parameters
smtpd_tls_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem
smtpd_tls_key_file=/etc/ssl/private/ssl-cert-snakeoil.key
smtpd_use_tls=yes
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache

# Set up the virtual alias
virtual_alias_maps = hash:/etc/postfix/virtual
relay_domains = mydomain.com

# enter hostname in a shell to know what's yours
myhostname = my_hostname
myorigin = mydomain.com
#mydestination = $myhostname, $myorigin, localhost
# My IP address V4 and V6
mynetworks = 127.0.0.0/8 0.0.0.0/32 [:::::/128]

mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = all

# Avoid being spam relay
smtpd_recipient_restrictions = 
	reject_invalid_hostname,
    reject_unknown_recipient_domain,
    reject_unauth_destination,
    reject_rbl_client sbl.spamhaus.org,
    permit

# Avoid being spam relay
smtpd_helo_restrictions = 
    reject_invalid_helo_hostname,
    reject_non_fqdn_helo_hostname,
    reject_unknown_helo_hostname,
    permit

/etc/postfix/virtual

# Run this command after updating this file: postmap /etc/postfix/virtual
titouan13@mydomain.com my_personal_email_address

Feel free to use this amazing tool to check your config:
http://mxtoolbox.com/

Leave a Reply

Your email address will not be published. Required fields are marked *