Hi, Is there any way to disable Dovecot LDA? I want to always send email via postfix and relay server even it will be a local delivery within the Dovecot server Thanks, Adam -------------- next part -------------- An HTML attachment was scrubbed... URL: <https://dovecot.org/pipermail/dovecot/attachments/20200331/099b2d6f/attachment.html>
> On 31/03/2020 19:35 Adam Raszkiewicz <araszkiewicz at medallies.com> wrote: > > > > Hi, > > > Is there any way to disable Dovecot LDA? I want to always send email via postfix and relay server even it will be a local delivery within the Dovecot server >Dovecot LDA is fully optional. Just don't use it in postfix configuration Aki> > Thanks, > > Adam
But then it loops again when get back to the postfix as an incoming message (doesn't know that abcd at localdomain.com is located on that Dovecot) <https://img.newoldstamp.com/r/292975/p> Adam Raszkiewicz p: 845.896.0191 e: araszkiewicz at medallies.com w: www.medallies.com <http://www.medallies.com/main.html> <https://img.newoldstamp.com/r/292975/twitter> <https://img.newoldstamp.com/r/292975/linkedin> <https://img.newoldstamp.com/r/292975/instagram> <https://img.newoldstamp.com/r/292975/b> This communication and any files or attachments transmitted with it may contain information that is confidential, privileged and exempt from disclosure under applicable law. It is intended solely for the use of the individual or the entity to which it is addressed. If you are not the intended recipient, you are hereby notified that any use, dissemination, or copying of this communication is strictly prohibited by federal law. If you have received this communication in error, please destroy it and notify the sender. ?On 3/31/20, 1:45 PM, "dovecot on behalf of Aki Tuomi" <dovecot-bounces at dovecot.org on behalf of aki.tuomi at open-xchange.com> wrote: > On 31/03/2020 19:35 Adam Raszkiewicz <araszkiewicz at medallies.com> wrote: > > > > Hi, > > > Is there any way to disable Dovecot LDA? I want to always send email via postfix and relay server even it will be a local delivery within the Dovecot server > Dovecot LDA is fully optional. Just don't use it in postfix configuration Aki > > Thanks, > > Adam
Dauser Martin Johannes
2020-Apr-01 20:33 UTC
Send local generated mails via gateway back to LDA Dovecot
Well as you need LDA to deliver emails from postfix to dovecot, you can't just turn it off. What you need is a second smtp daemon within postfix, which is only responsible for local originating emails and is configured to send any email to your gateway. This way your second smtpd will send local generated mails to your gateway. The gateway will send those mails back to your default smtpd and this one will deliver those mails to dovecot -- or where ever you configured them to go to. As email addresses like localpart at localhost aren't useful for your gateway, you need to (canonical) rewrite those addresses to an official address. --------------------------------------------------------------- This means your default smtpd must not listen on localhost anymore. The default entry in master.cf like "smtp inet n - n - - smtpd" means that the smtpd listens on any interface on smtp port number 25. Now you need it to listen on the smtp port of your official IP address only. Therefore we will override inet_interfaces from main.cf . Your second smtpd, newly defined in master.cf, inherits the default values from main.cf too, so you need to adjust only some. Well and this daemon will listen on localhost only. Note1: This config runs without a chroot environment! If you do, some extra adjustments might be necessary. (I don't know for sure.) Note2: Lines starting with dash (-) should be removed in your config and those beginning with plus (+) should be added. Angled brackets (<>) indicate a placeholder and they should not be present in your config. /etc/postfix/master.cf # =========================================================# service type private unpriv chroot wakeup maxproc command + args # =========================================================-smtp inet n - n - - smtpd +smtp inet n - n - - smtpd + # Incomming mails only from real IP address -o inet_interfaces=<IP mailserver> +127.0.0.1:25 inet n - n - - smtpd + # Incomming mails only from loopback device + # use only if appropriate in your case (postfix version >=2.2) + -o inet_interfaces=loopback-only + # Incomming mails only from localhost + # use only if appropriate in your case (postfix version < 2.2) + -o inet_interfaces=localhost,127.0.0.1 + # Empty mydestination to disable local transport + -o mydestination+ # disable LDA delivery by emptying corresponding config entries + # you either use mailbox_command or virtual_mailbox_domains + -o mailbox_command+ -o virtual_mailbox_domains+ # Use this IP address as client to connect to gateway + -o smtp_bind_address=<IP mailserver> + # Canonical rewrite for sender and recipient addresses with @localhost + -o canonical_maps = pcre:/etc/postfix/canonical_localhost.pcre --------------------------------------------------------------- New file /etc/postfix/canonical_localhost.pcre # This is a Perl Compatible Regular Expression table, # so no postmap command is needed. # Address something at localhost becomes something@<yourmaildomain.tld> # or # address something at localhost becomes root@<yourmaildomain.tld> # CHOOSE ONLY ONE ! # #/^(.+)@localhost$/ $1@<yourmaildomain.tld> /^.+ at localhost$/ root@<yourmaildomain.tld> --------------------------------------------------------------- Local generated mails, that have no domain information should append the string $mydomain instead of default $myorigin (which normally is the FQDN of your mailserver). /etc/postfix/main.cf - append_at_myorigin = yes + append_at_myorigin = no - append_dot_mydomain = no + append_dot_mydomain = yes --------------------------------------------------------------- I guess you already set $relayhost but you can set fallbacks too. /etc/postfix/main.cf relayhost = <gateway.domain.tld> +# Optional list of relay hosts +smtp_fallback_relay = <IP of your gateway>, <secondary gateway if available> --------------------------------------------------------------- Of course you need to restart postfix to apply these changes. AND if something breaks don't hold me responsible, use this config at your own risk! Martin On Dienstag, 31. M?rz 2020 18:35:07 CEST Adam Raszkiewicz wrote:> Hi, > > Is there any way to disable Dovecot LDA? I want to always send email via > postfix and relay server even it will be a local delivery within the > Dovecot server> Thanks, > Adam