Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have problem with distribution emails, I need email from domain @cokdeje.cz send to user forexample info, from domain @surfujeme.cz to another, etc.

/etc/postfix/main.cf

smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu)
biff = no
append_dot_mydomain = no
readme_directory = no
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
myhostname = mail.surfujeme.cz
virtual_maps = hash:/etc/postfix/virtual
alias_database = hash:/etc/aliases
mydestination = $myhostname, /etc/postfix/domains
relayhost =
mynetworks =
mailbox_size_limit = 0
recipient_delimiter =
inet_interfaces = all
myorigin = /etc/mailname
default_transport = smtp
relay_transport = smtp
inet_protocols = all
home_mailbox = Maildir/

My virtual users (it's probable not work):

/etc/postfix/virtual


webcreating.cz  DOMAIN
@webcreating.cz         info

surfujeme.cz    DOMAIN
@surfujeme.cz           info

frosty22.cz     DOMAIN
@frosty22.cz            info

e-lekce.cz      DOMAIN
@e-lekce.cz             info

cokdeje.cz      DOMAIN
@cokdeje.cz             info

zujimode.cz     DOMAIN
@zujimode.cz            zujimodecz

And my virtual users,

/etc/passwd

info:x:1001:1004:Vít Ledvinka,,,:/home/info:/sbin/nologin
zujimodecz:x:1002:1005::/home/zujimodecz:/sbin/nologin
...

And /etc/postfix/domains

zujimode.cz
surfujeme.cz
cokdeje.cz
frosty22.cz
e-lekce.cz

I add user to file virtual, run postmap /etc/postfix/virtual but still all messages are in info mailbox, but when I delete some row from virtual file (example I remove: @zujimode.cz zujimodecz email cannot send to this domain, but when I write anything like username (info/zujimodecz/elekce/..) still all emails are in info mailbox.

Thanks so much for help! I work with it for one week, but I can't solve it ;(

share|improve this question
add comment

3 Answers

Did define the domains in the virtual-file?

it needs to look like this:

example.com  ANYTHING
foo@example.com some-user
bar@example.com some-other-user
@example.com catch-all-user
share|improve this answer
    
I edit my post, to my actual changes which I maked by debian-administration.org/articles/243 but still not work, and all domain look like @surfujeme.cz (so when I change in virtual* file **@surfujeme.cz someone all emails from all domains are sended to user "someone" irrespective of domain name. –  frosty22 Aug 30 '11 at 22:39
add comment

You should have virtual domains in the virtual_alias_domains and virtual_maps_domains configuration settings, not in mydestination as you currently do.

share|improve this answer
    
I repaired virtual-file like is above, and I tried virtual_alias_domain, virtual_maps_domains, but I still same problem, but I found mainly problem - all emails are sended to @surfujem.cz domain mailbox - it does not distinguish domain name. When I change in virtual file @surfujeme.cz zujimodecz all emails send to this mailbox. –  frosty22 Aug 30 '11 at 22:01
    
Now, I found detailed information - it's ignore multiple domains and all emails are directed to domain from: myorigin = /etc/mailname, but when I change it to $mydomain, it still same –  frosty22 Aug 31 '11 at 13:06
add comment

I make some corrects, and now all emails are stored by $mydomain:

main.cf

smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu)
biff = no
append_dot_mydomain = no
readme_directory = no
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
mydomain = surfujeme.cz
myhostname = mail.surfujeme.cz
alias_maps = hash:/etc/aliases
virtual_alias_maps = hash:/etc/postfix/virtual
alias_database = hash:/etc/aliases
virtual_alias_domains = /etc/postfix/domains
mydestination = $myhostname localhost /etc/postfix/domains
relayhost = 
relay_domains = $mydestination
mailbox_size_limit = 0
recipient_delimiter = 
inet_interfaces = all
myorigin = $mydomain
default_transport = smtp
relay_transport = smtp
inet_protocols = all
home_mailbox = Maildir/

virtual

webcreating.cz  DOMAIN
@webcreating.cz     info

surfujeme.cz    DOMAIN
@surfujeme.cz       info

frosty22.cz DOMAIN
@frosty22.cz        info

e-lekce.cz  DOMAIN
@e-lekce.cz     elekcecz

cokdeje.cz  DOMAIN
@cokdeje.cz     cokdejecz

zujimode.cz DOMAIN
@zujimode.cz        zujimodecz

When send email to some domain:

anything@surfujeme.cz
anything@zujimode.cz
anything@cokdeje.cz

Postfix ignore domainname and use domain from main.cf => setting myorigin which is from mydomain and in virtual file find correct user info.

How I repair it? I don't need ignore domain name ;( I try it for 1 week, still nothing.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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