-1

I need help to configure a postfix in a server as recipient and sender for many virtual domains and sub-domains. I want every email sent from any local recipient of this server reaches its destination with its own virtual domain, regardless that it's a local delivery or not.

I have setting the main.cf to receive every email ("virtual_user@virtual_domain") in its own virtual home; up to this point, everything works fine. But when I try to send email from any recipient of this server to a local or foreign recipient, the email is sent with the hostname of this server as its domain ("virtual_user@hostname").

The server: Linux name 3.16.0-4-amd64 #1 SMP Debian 3.16.7-ckt11-1 (2015-05-24) x86_64 GNU/Linux

Postfix 2.11.3-1

name.domain is FQDN of server.

This is my main.cf

# See /usr/share/postfix/main.cf.dist for a commented, more complete version
# Debian specific:  Specifying a file name will cause the first
# line of that file to be used as the name.  The Debian default
# is /etc/mailname.
#myorigin = /etc/mailname # **line 1: "name.domain"**
smtpd_banner = $myhostname ESMTP $mail_name (Debian/GNU)
biff = no
# appending .domain is the MUA's job.
append_dot_mydomain = no
# Uncomment the next line to generate "delayed mail" warnings
#delay_warning_time = 4h
readme_directory = no
home_mailbox = Maildir/
#mailbox_command = procmail -a "$EXTENSION"
virtual_mailbox_domains = /etc/postfix/vhosts # **line 1: "domain" & line 2: "other.domain"**
virtual_mailbox_base = /home
virtual_mailbox_maps = hash:/etc/postfix/vmailbox # **line 1: "user1@domain domain/user1/Maildir/" & line 2: "[email protected] other.domain/user2/Maildir/"**
virtual_minimum_uid = 2000
virtual_uid_maps = hash:/etc/postfix/vuid # **line 1: "user1@domain 2001" & line 2: "[email protected] 2002"**
virtual_gid_maps = $virtual_uid_maps
virtual_alias_maps = hash:/etc/postfix/valias # **line 1: "user1@domain user1" & line 2: "[email protected] user2"**
#virtual_alias_domains =
# TLS parameters (server mode)
smtpd_tls_cert_file = /etc/dovecot/private/name.pem
smtpd_tls_key_file = /etc/dovecot/private/name.pem
smtpd_tls_CAfile = /etc/dovecot/private/name.pem
#smtpd_tls_cert_file = /etc/ssl/certs/ssl-cert-snakeoil.pem
#smtpd_tls_key_file = /etc/ssl/private/ssl-cert-snakeoil.key
#smtpd_tls_CAfile = /etc/postfix/certs/new-ca.crt
smtpd_use_tls = yes
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtpd_tls_loglevel = 1
smtpd_tls_received_header = yes
# TLS to encrypt the connection to relay host (client mode)
smtp_use_tls = yes
smtp_tls_loglevel = 1
smtp_tls_note_starttls_offer = yes
smtp_tls_CApath = /etc/ssl/certs/
#smtp_tls_security_level = secure
tls_random_source = dev:/dev/urandom
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
# See /usr/share/doc/postfix/TLS_README.gz in the postfix-doc package for
# information on enabling SSL in the smtp client.
# SMTP-SASL-AUTH (server mode)
smtpd_sasl_auth_enable = yes
#smtpd_sasl_application_name = smtpd
smtpd_sasl_local_domain = $myhostname
smtpd_sasl_security_options = noanonymous
broken_sasl_auth_clients = yes
smtpd_sasl_authenticated_header = yes
# SMTP-SASL-AUTH (client mode)
#smtp_sasl_auth_enable = yes
# auth -- credentials to authenticate yourself to relay hosts
#smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
#smtp_sender_dependent_authentication = yes
#sender_dependent_relayhost_maps = hash:/etc/postfix/sender_relay
#smtp_sasl_security_options = noanonymous
#smtp_sasl_tls_security_options = noanonymous
#sasl auth with dovecot
#smtpd_sasl_type = dovecot
#smtpd_sasl_path = private/auth
smtpd_relay_restrictions = permit_mynetworks permit_sasl_authenticated defer_unauth_destination
smtpd_recipient_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_unauth_destination
smtpd_client_restrictions = check_client_access hash:/etc/postfix/access
smtpd_sender_restrictions = check_sender_access hash:/etc/postfix/access
myhostname = name.domain
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
**mydestination = $myhostname, localhost # ????**
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
#relayhost =
**transport_maps = hash:/etc/postfix/transport # ????**
**default_transport = smtp # ????**
#local_transport = local:$myhostname
**local_transport = local:$virtual_mailbox_domains # ????**
message_size_limit = 2048000
mailbox_size_limit = 100000000
virtual_mailbox_limit = $mailbox_size_limit
smtpd_recipient_limit = 150
smtpd_recipient_overshoot_limit = 300
smtpd_client_connection_rate_limit = 60
smtpd_client_message_rate_limit = 60
smtpd_client_recipient_rate_limit = 300
smtpd_client_new_tls_session_rate_limit = 60
smtpd_client_event_limit_exceptions = no
recipient_delimiter = +
#inet_interfaces = all
inet_protocols = ipv4
# alias to map internal to external
**#smtp_generic_maps = hash:/etc/postfix/generic # does not resolve the local delivery**

# header checks
#header_checks = pcre:/etc/postfix/header_checks
#mime_header_checks = pcre:/etc/postfix/header_checks
#nested_header_checks = pcre:/etc/postfix/header_checks
# smtp header checks
#smtp_header_checks = pcre:/etc/postfix/header_checks
#smtp_mime_header_checks = pcre:/etc/postfix/header_checks
#smtp_nested_header_checks = pcre:/etc/postfix/header_checks

1 Answer 1

-2

In main.cf:

canonical_maps = hash:/etc/postfix/canonical

And then in /etc/postfix/canonical:

user1    user1@domain
user2    [email protected]
1
  • 4
    Please also give explanations in your answer and use the formatting features.
    – sebix
    Jun 26, 2015 at 19:29

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .