2

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)

NicoJuicy
  • 141
  • 2
  • 10
  • 1
    Please post the `maillog` entry when you send email to alias address. Also, it would be nice to post the output of `postconf -n` instead the content of `main.cf` – masegaloeh Apr 09 '15 at 04:17
  • replaced main.cf with postconf -n, but nothing is in my log of postfix ( /var/log/mail.log and the errors in /var/log/mail.err are when i adjusted the settings with small errors and tried reloading postfix) – NicoJuicy Apr 09 '15 at 06:38
  • 1
    Well, if there are no entry on mail.log then email is never coming to your server and postfix can't forward/alias your email. When telnet-ing port 25, can you find some entry recorded in mail.log? Of course it would be helpful if you **disclose the real domain name**. See [What information should I include or obfuscate in my posts?](http://meta.serverfault.com/q/963/218590) – masegaloeh Apr 09 '15 at 06:45
  • The real domain is moederpupegaele.be and telnet works when i mail to juice@moederpupegaele.be ( created this as a temp address). In most cases it just doesn't get delivered – NicoJuicy Apr 09 '15 at 07:46

1 Answers1

5

Remove the example.com from mydestination 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:

Warnings:

Do not specify the names of virtual domains - those domains are specified elsewhere. See VIRTUAL_README for more information.

You can follow the mentioned documentation, but AFAIK the configuration seems otherwise ok.

Esa Jokinen
  • 46,944
  • 3
  • 83
  • 129