This commit is contained in:
Robert Schumann 2017-06-08 08:39:39 +00:00 committed by GitHub
commit 308e82b66a
5 changed files with 40 additions and 0 deletions

View File

@ -134,6 +134,13 @@ run:
-e POSTFIX_DAGENT=lmtp:127.0.0.1:24 \
-h mail.my-domain.com -t $(NAME)
sleep 30
docker run -d --name mail_lmtp_address_extension \
-v "`pwd`/test/config":/tmp/docker-mailserver \
-v "`pwd`/test/config/dovecot-lmtp":/etc/dovecot \
-v "`pwd`/test":/tmp/docker-mailserver-test \
-e ENABLE_LMTP_ADDRESS_EXTENSION=1 \
-h mail.my-domain.com -t $(NAME)
sleep 30
docker run -d --name mail_with_postgrey \
-v "`pwd`/test/config":/tmp/docker-mailserver \
-v "`pwd`/test":/tmp/docker-mailserver-test \
@ -169,6 +176,8 @@ fixtures:
docker exec mail_disabled_clamav_spamassassin /bin/sh -c "nc 0.0.0.0 25 < /tmp/docker-mailserver-test/email-templates/existing-user1.txt"
# postfix virtual transport lmtp
docker exec mail_lmtp_ip /bin/sh -c "nc 0.0.0.0 25 < /tmp/docker-mailserver-test/email-templates/existing-user1.txt"
# ltmp address extension
docker exec mail_lmtp_address_extension /bin/sh -c "nc 0.0.0.0 25 < /tmp/docker-mailserver-test/email-templates/existing-user1-address-extension.txt"
docker exec mail_override_hostname /bin/sh -c "nc 0.0.0.0 25 < /tmp/docker-mailserver-test/email-templates/existing-user1.txt"
# Wait for mails to be analyzed
@ -194,6 +203,7 @@ clean:
mail_with_ldap \
mail_with_imap \
mail_lmtp_ip \
mail_lmtp_address_extension \
mail_with_postgrey \
mail_override_hostname

View File

@ -337,3 +337,9 @@ Enabled by ENABLE_POSTFIX_VIRTUAL_TRANSPORT. Specify the final delivery of postf
- lmtp:<kopano-host>:2003 (use kopano as mailstore)
- etc.
##### ENABLE_LMTP_ADDRESS_EXTENSION
Enable dovecot to deliver mails to specific (new) inbox folders, if separated like account+folder@domain.com.
- **empty** => disabled
- 1 => enabled

View File

@ -22,6 +22,7 @@ DEFAULT_VARS["ENABLE_SASLAUTHD"]="${ENABLE_SASLAUTHD:="0"}"
DEFAULT_VARS["SMTP_ONLY"]="${SMTP_ONLY:="0"}"
DEFAULT_VARS["DMS_DEBUG"]="${DMS_DEBUG:="0"}"
DEFAULT_VARS["OVERRIDE_HOSTNAME"]="${OVERRIDE_HOSTNAME}"
DEFAULT_VARS["ENABLE_LMTP_ADDRESS_EXTENSION"]="${ENABLE_LMTP_ADDRESS_EXTENSION:="0"}"
##########################################################################
# << DEFAULT VARS
##########################################################################
@ -498,6 +499,11 @@ function _setup_dovecot() {
chown docker:docker /usr/lib/dovecot/sieve-pipe/*
chmod 550 /usr/lib/dovecot/sieve-pipe/*
fi
if [ "$ENABLE_LMTP_ADDRESS_EXTENSION" = 1 ]; then
notify 'inf' "Dovecot/lmtp address extension enabled"
sed -i -e 's/#lmtp_save_to_detail_mailbox = no/lmtp_save_to_detail_mailbox = yes/g' /etc/dovecot/conf.d/20-lmtp.conf
fi
}
function _setup_dovecot_local_user() {

View File

@ -0,0 +1,12 @@
HELO mail.external.tld
MAIL FROM: user@external.tld
RCPT TO: user1+subfolder@localhost.localdomain
DATA
From: Docker Mail Server <dockermailserver@external.tld>
To: Existing Local User <user1+subfolder@localhost.localdomain>
Date: Sat, 22 May 2010 07:43:25 -0400
Subject: Test Message
This is a test mail.
.
QUIT

View File

@ -1134,6 +1134,12 @@ load 'test_helper/bats-assert/load'
assert_output 1
}
@test "checking postfix-lmtp-address-extension: delivers mail to existing account and inbox subfolder" {
run docker exec mail_lmtp_address_extension /bin/sh -c "grep -c 'dovecot: lmtp.*: saved mail to subfolder' var/log/mail/mail.log"
assert_success
assert_output 1
}
#
# PCI compliance
#