1

I set up my Postfix to use virtual mailboxes. When I telnet the mail server and send an email from that, it works flawlessly (both when on the mail server and telnetting from a remote client). The mail file lands inside the specified directory under 'new'.

But if I send an email from outside, without Telnet, the mail lands inside /var/mail/ as a file recipient (e.g. xyxl) theoretically containing all emails sent to that recipient as opposed to the wanted directory /var/mail/vmail/xyxl/new as a file only containing one email.

Could this be related to permission problems? I set up the /var/mail/vmail to have the owner vmail and the group owner vmail which have uid=5000 and gid=5000. I did that just because I saw it done multiple times and thought this was okay. Maybe postfix defaults to the /var/mail instead of /var/mail/vmail because it has no permissions? But I read that postfix when receiving mail logs-in to the recipients account and writes the email file as that user. And the recipient xyxl is part of the group vmail. But why would it work via telnet and not via normal email then ...

My setup is nothing special, just one Postfix in the whole local network acting as the gateway (no relay is happening if that was the wrong term).

Postfix obviously accepts the email, but I will include the log anyways.

Output of postconf -n

append_dot_mydomain = no
biff = no
config_directory = /etc/postfix
inet_interfaces = all
inet_protocols = ipv4
mailbox_size_limit = 0
mydestination = $mydomain, localhost.localdomain, localhost
mydomain = mail.example.net
myhostname = foobar
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
myorigin = mail.example.net
readme_directory = no
recipient_delimiter = +
relayhost =
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
smtpd_banner = $myhostname ESMTP $mail_name (Debian/GNU)
smtpd_recipient_limit = 5
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_gid_maps = static:5000
virtual_mailbox_base = /var/mail/vmail
virtual_mailbox_domains = example.net
virtual_mailbox_maps = hash:/etc/postfix/vmailbox
virtual_minimum_uid = 100
virtual_uid_maps = static:5000

My /etc/postfix/vmailbox

xyxl@example.net    example.net/xyxl/

postfix.log addressed to xyxl@mail.example.net

Feb  7 00:42:16 foobar postfix/smtpd[14942]: warning: dict_nis_init: NIS domain name not set - NIS lookups disabled
Feb  7 00:42:16 foobar postfix/smtpd[14942]: connect from mail-wg0-f46.google.com[74.125.82.46]
Feb  7 00:42:16 foobar postfix/smtpd[14942]: 3A4C6BFDC2: client=mail-wg0-f46.google.com[74.125.82.46]
Feb  7 00:42:16 foobar postfix/cleanup[14945]: 3A4C6BFDC2: message-id=<54D55171.8050008@gmail.com>
Feb  7 00:42:16 foobar postfix/qmgr[13866]: 3A4C6BFDC2: from=<xyxl@gmail.com>, size=1848, nrcpt=1 (queue active)
Feb  7 00:42:16 foobar postfix/local[14946]: warning: dict_nis_init: NIS domain name not set - NIS lookups disabled
Feb  7 00:42:16 foobar postfix/smtpd[14942]: disconnect from mail-wg0-f46.google.com[74.125.82.46]
Feb  7 00:42:16 foobar postfix/local[14946]: 3A4C6BFDC2: to=<xyxl@mail.example.net>, relay=local, delay=0.14, delays=0.1/0/0/0.04, dsn=2.0.0, status=sent (delivered to mailbox)
Feb  7 00:42:16 foobar postfix/qmgr[13866]: 3A4C6BFDC2: removed

postfix.log addressed to xyxl@example.net

Feb  7 01:43:52 NSFW postfix/smtpd[17722]: warning: dict_nis_init: NIS domain name not set - NIS lookups disabled
Feb  7 01:43:52 NSFW postfix/smtpd[17722]: connect from mail-we0-f180.google.com[74.125.82.180]
Feb  7 01:43:52 NSFW postfix/smtpd[17722]: E623EBFDC5: client=mail-we0-f180.google.com[74.125.82.180]
Feb  7 01:43:52 NSFW postfix/cleanup[17726]: E623EBFDC5: message-id=<54D55FE1.40601@gmail.com>
Feb  7 01:43:53 NSFW postfix/qmgr[13866]: E623EBFDC5: from=<xyxl@gmail.com>, size=1832, nrcpt=1 (queue active)
Feb  7 01:43:53 NSFW postfix/local[17727]: warning: dict_nis_init: NIS domain name not set - NIS lookups disabled
Feb  7 01:43:53 NSFW postfix/smtpd[17722]: disconnect from mail-we0-f180.google.com[74.125.82.180]
Feb  7 01:43:53 NSFW postfix/local[17727]: E623EBFDC5: to=<xyxl@mail.example.net>, relay=local, delay=0.13, delays=0.09/0.01/0/0.03, dsn=2.0.0, status=sent (delivered to mailbox)
Feb  7 01:43:53 NSFW postfix/qmgr[13866]: E623EBFDC5: removed
  • Do you send mail from external to someone@example.net or someone@mail.example.net? Because mail.example.net is in your $mydestinatoin parameter, only example.net is a virtual mailbox domain. This means someone@mail.example.net is a treated as a system user account and gets its mail delivered to /var/mail/someone. Maybe read through postfix.org/VIRTUAL_README.html again to understand the distinctions. – daff Feb 7 '15 at 0:24
  • I send it to someone@mail.example.net since the MX is not set up yet and I have another mail server on that domain. However there is a DNS A-Entry from mail.example.net to the servers IP. Edit: I just tried to write to someone@example.net and the delivery worked (the MX is set up already), but the mail lands at /var/mail/someone again. – xyxl Feb 7 '15 at 0:26
  • 1
    That's your problem then. Or rather it works exactly as designed. mail.example.com in your case is a canonical domain and "final destination" for incoming mail. Postfix delivers mail to an account in that domain directly to a UNIX user's mailbox. It is all explained in the first few paragraphs of postfix.org/VIRTUAL_README.html. – daff Feb 7 '15 at 0:32
  • Can you add log excerpts that show mail coming in for someone@example.net? Also please add the output of postconf -n so that we can see what Postfix really thinks its configuration is. Edit: by someone@example.net I mean an actual virtual account you have set up in virtual_mailbox_maps. I guess that would be typo@example.net. – daff Feb 7 '15 at 0:38
  • 1
    Then I have no idea. Your Postfix config looks correct but your logs clearly show that Postfix receives the message for xyxl@mail.example.net, not xyxl@example.net. So either you are using the wrong address when composing your test message in Gmail or some other magic happens somewhere else that fouls things up. – daff Feb 7 '15 at 1:16
2

I just repeat what daff said:

Your log line was telling the truth. The sender sent the email with recipient address xyxl@mail.example.net.

Unless you can prove that the sender composed email with recipient xyxl@example.net and magically google transform it to xyxl@mail.example.net, there are nothing to do here. It's the client fault not your Server Fault.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.