I’m trying to pipe one specific address to php script but it seems my transport_maps doesn’t trigger, instead of it the virtual_transport is used. Here is what I have:
@example.com is listed in virtual_mailbox_domains and the delivery to virtual mailboxes works fine.
But I need to forward all messages for foo@example.com not to dovecot-lda (which is specified in virtual_transport) but to another service.
This is my delivery method for virtual_transport:
dovecot unix – n n – – pipe flags=DRhu user=vmail:vmail argv=/usr/lib/dovecot/dovecot-lda -f ${sender} -d ${recipient}
This is is where I want to pipe all foo@example.com
php_script unix – n n – – pipe flags=Fq user=www-data argv=/home/script.php
postconf -n
alias_database = hash:/etc/aliases
alias_maps = hash:/etc/aliases
append_dot_mydomain = no
biff = no
config_directory = /etc/postfix
dovecot_destination_recipient_limit = 1
mailbox_size_limit = 0
milter_default_action = accept
milter_protocol = 2
mydestination = localhost
myhostname = localhost
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
myorigin = /etc/mailname
non_smtpd_milters = net:localhost:12301
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_milters = inet:localhost:12301
smtpd_recipient_restrictions =
smtpd_relay_restrictions = permit_sasl_authenticated permit_mynetworks
defer_unauth_destination
smtpd_sasl_auth_enable = yes
smtpd_sasl_path = private/auth
smtpd_sasl_type = dovecot
smtpd_tls_auth_only = yes
smtpd_tls_cert_file = /etc/ssl/certs/mailserver.pem
smtpd_tls_key_file = /etc/ssl/private/mailserver.pem
smtpd_tls_security_level = may
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtpd_use_tls = yes
transport_maps = hash:/etc/postfix/transport
virtual_alias_maps = mysql:/etc/postfix/mysql-virtual-alias-maps.cf
virtual_mailbox_domains = mysql:/etc/postfix/mysql-virtual-mailbox-
domains.cf
virtual_mailbox_maps = mysql:/etc/postfix/mysql-virtual-mailbox-maps.cf
virtual_transport = dovecot
in /etc/postfix/transport foo@example.com php_script
It seems the postfix just ignore transport_map, I always get User unknown in virtual mailbox table. Which is correct there is no such user, but I want to forward the mail via transport_maps before check if is there virtual user.
Anyone could help? Spend two days searching, reading man and trying but seems it’s just doesn’t work.
Advertisement
Answer
Ok I got the solution:
It seems postfix does not work with both virtual_transport and transport_maps so I have created in virual_aliases the forward to foo@localhost and then I use the transport_maps file to pipe foo@localhost to script 🙂