Here is what i did:
- apt-get install postfix
- picked "internet mail"
- added a file "virtual" and appended a list with emails and emails (see below for sample)
- when changing postfix, i always updated the virtual db ( with command) and reloaded + restarted the postfix service
- example.com has a A-Record to the correct IP (hosting + Mailserver on the same server). (Also, Telnet connection doesn't give an error when connecting)
Example of the virtual file
a_random_email@example.com my_email@gmail.com
a_random_email_2@example.com my_email_2@gmail.com
Here's what i didn't do (and it's not required) i suppose:
- Did not create a ubuntu user per email (that's why i'm using virtual domains)
This is the contents of postconf -n
root@Host-Wordpress-01:~# postconf -n
alias_database = hash:/etc/aliases
append_dot_mydomain = no
biff = no
config_directory = /etc/postfix
home_mailbox = mail/
inet_interfaces = all
inet_protocols = all
mailbox_size_limit = 0
mydestination = example.com, Host-Wordpress-01, localhost.localdomain, localhost
myhostname = example.com
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
myorigin = /etc/mailname
readme_directory = no
recipient_delimiter = +
relayhost =
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu)
smtpd_relay_restrictions = permit_mynetworks permit_sasl_authenticated defer_unauth_destination
smtpd_tls_cert_file = /etc/ssl/certs/ssl-cert-snakeoil.pem
smtpd_tls_key_file = /etc/ssl/private/ssl-cert-snakeoil.key
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtpd_use_tls = yes
virtual_alias_domains = example.com
virtual_alias_maps = hash:/etc/postfix/virtual
I don't understand why, but i have one emailaddress that CAN mail to myselve (the forward = the sender mail). All other situations aren't working.
For example, when my virtual file contains:
a_random_email@example.com my_email@gmail.com
When i mail from my_email@gmail.com to a_random_email@example.com, then it gets into the inbox of my_email@gmail.com… Weird :s
There is no email in the postfix queue
I have already search through serverfault to find relevant questions, i haven't found any that solves my issue…
I'd like to solve this but an alternative for postfix ( if simple) is also accepted.. ( haven't found any though)
Best Answer
Remove the
example.com
frommydestination
as mail to domains in that list is delivered via the$local_transport
mail delivery transport. This is so common mistake it is separately warned in Postfix main.cf file format documentation of parameter mydestination:You can follow the mentioned documentation, but AFAIK the configuration seems otherwise ok.