From d490c645a54503defc66f48b1a1bb2eff15629a3 Mon Sep 17 00:00:00 2001 From: Quentin Legot Date: Tue, 17 Oct 2023 17:00:33 +0200 Subject: [PATCH] Can now send mail to imap throught smtp --- dockerfiles/dovecot/dovecot.conf | 5 ++++- dockerfiles/postfix/Dockerfile | 1 + dockerfiles/postfix/main.cf | 7 ++++--- dockerfiles/postfix/startup.sh | 1 + dockerfiles/postfix/virtual | 2 +- dockerfiles/postfix/vmailbox | 2 ++ 6 files changed, 13 insertions(+), 5 deletions(-) create mode 100644 dockerfiles/postfix/vmailbox diff --git a/dockerfiles/dovecot/dovecot.conf b/dockerfiles/dovecot/dovecot.conf index e8d9ec4..a912e11 100644 --- a/dockerfiles/dovecot/dovecot.conf +++ b/dockerfiles/dovecot/dovecot.conf @@ -6,7 +6,7 @@ mail_location=sdbox:~/Mail # mail_uid=1000 # mail_gid=10000 -protocols = imap submission lmtp +protocols = imap lmtp # first_valid_uid = 1000 # last_valid_uid = 10000 @@ -34,8 +34,11 @@ namespace { separator = / } +lmtp_proxy = yes + service lmtp { inet_listener { + address = 0.0.0.0 port = 24 } } diff --git a/dockerfiles/postfix/Dockerfile b/dockerfiles/postfix/Dockerfile index 9c28ad7..899576e 100644 --- a/dockerfiles/postfix/Dockerfile +++ b/dockerfiles/postfix/Dockerfile @@ -6,6 +6,7 @@ COPY startup.sh /usr/bin/startup.sh RUN chmod +x /usr/bin/startup.sh COPY main.cf /etc/postfix/main.cf COPY virtual /etc/postfix/virtual +COPY vmailbox /etc/postfix/vmailbox EXPOSE 25 EXPOSE 465 diff --git a/dockerfiles/postfix/main.cf b/dockerfiles/postfix/main.cf index 15991c2..ceb0a5a 100644 --- a/dockerfiles/postfix/main.cf +++ b/dockerfiles/postfix/main.cf @@ -3,12 +3,13 @@ maillog_file = /dev/stdout # this setting has several side-effects, e.g. the domain of this mail # server is now example.com, http://www.postfix.org/postconf.5.html#mydomain -myhostname = virt.local +myhostname = smtp.virt.local +mynetworks = 127.0.0.0/8 10.0.0.0/8 192.0.0.0/8 172.17.0.0/16 # disable all compatibility levels compatibility_level = 9999 -virtual_mailbox_domains = virt.local -virtual_mailbox_maps = lmdb:/etc/postfix/virtual +virtual_mailbox_domains = imap.virt.local virt.local +virtual_mailbox_maps = lmdb:/etc/postfix/vmailbox virtual_alias_maps = lmdb:/etc/postfix/virtual virtual_transport = lmtp:mail-dovecot.default.svc.cluster.local:24 \ No newline at end of file diff --git a/dockerfiles/postfix/startup.sh b/dockerfiles/postfix/startup.sh index d8762ce..8296c18 100644 --- a/dockerfiles/postfix/startup.sh +++ b/dockerfiles/postfix/startup.sh @@ -3,6 +3,7 @@ set -ex postmap /etc/postfix/virtual +postmap /etc/postfix/vmailbox newaliases exec postfix start-fg diff --git a/dockerfiles/postfix/virtual b/dockerfiles/postfix/virtual index fdb0d60..b3f2858 100644 --- a/dockerfiles/postfix/virtual +++ b/dockerfiles/postfix/virtual @@ -1 +1 @@ -@virt.local user@virt.local \ No newline at end of file +postmaster@virt.local postmaster diff --git a/dockerfiles/postfix/vmailbox b/dockerfiles/postfix/vmailbox new file mode 100644 index 0000000..cfa70cc --- /dev/null +++ b/dockerfiles/postfix/vmailbox @@ -0,0 +1,2 @@ +user@virt.local whatever +user2@virt.local whatever \ No newline at end of file