Getmail - Mail Aliases and Forwards dont appear effected

,

NethServer Version: 7.3
Module: Getmail

I encountered an issue with Getmail and I hope someone can assist me.

Mails retrieved via Getmail (Multidrop) that are meant to be either forwarded, or are aliases are not processed accordingly.

Scenario is as follows;

  • all bbb mails are forwarded to ccc
  • also/alternatively support@acme is an alias for support group
  • aaa sends mail to bbb (This should be forwarded to ccc)
  • aaa sends another mail to support@acme.com (This should be received by all users in support group/alias)
  • Then Getmail (fetches email)
  • But if aaa sent the mails using different domain mailserver and Getmail fetches, the forwards and aliases dont work. Forwarded mails are delivered to the original recipient (not the forwarded user ccc). Aliases appear to get lost in the wild.
  • But if aaa sent the mails locally (from same server), the forwards and aliases work as expected (ccc will get the mail). So I believe the issue might be with Getmail

Getmail settings

[retriever]
type = MultidropPOP3Retriever
server = mbox.acme.com
username = mailbox@acme.com
password = mboxpassword
envelope_recipient = envelope-to:1

[destination]
type = MDA_external
path = /usr/libexec/dovecot/dovecot-lda
arguments = ("-e","-d","%(recipient)")
user = vmail
group = vmail

[filter-1]
type = Filter_classifier
path = /usr/bin/clamdscan
arguments = ("-c", "/etc/clamd.d/amavisd.conf", "--stdout", "--no-summary", "--infected", "-")
exitcodes_drop = (1,)
user = amavis


[filter-2]
type = Filter_external
path = /usr/bin/spamc
arguments = ("-E", "-s", "250000")
exitcodes_keep = (0, 1)
user = amavis
group = amavis

[options]
read_all = false
delete_after = 90
received = false
message_log = /var/log/getmail.log
message_log_verbose = true
delivered_to = true
max_message_size = 51200000

=====

Logs:

===Local send/delivery logs excerpt

May  7 20:32:43 mailserver postfix/qmgr[14040]: 0C7DC8024BD: from=<aaa@acme.com>, size=1177, nrcpt=2 (queue active)
May  7 20:32:43 mailserver postfix/smtpd[26553]: proxy-accept: END-OF-MESSAGE: 250 2.0.0 Ok: queued as 0C7DC8024BD; from=<aaa@acme.com> to=<bbb@acme.com> proto=ESMTP helo=<localhost>
May  7 20:32:43 mailserver postfix/smtpd[26556]: disconnect from localhost[127.0.0.1]
May  7 20:32:43 mailserver postfix/smtpd[26553]: disconnect from localhost[127.0.0.1]
May  7 20:32:43 mailserver dovecot: lmtp(26560): Connect from local
May  7 20:32:43 mailserver dovecot: lmtp(26560, ccc@acme.com): r+a1BDtaD1nAZwAAstsg1A: sieve: msgid=<3788-590f5a00-1-692b7f00@122227921>: stored mail into mailbox 'INBOX'
May  7 20:32:43 mailserver dovecot: lmtp(26560): Disconnect from local: Successful quit
May  7 20:32:43 mailserver postfix/lmtp[26558]: 0C7DC8024BD: to=<ccc@acme.com>, orig_to=<bbb@acme.com>, relay=mailserver.acme.com[/var/run/dovecot/lmtp], delay=0.05, delays=0.02/0.01/0/0.02, dsn=2.0.0, status=sent (250 2.0.0 <ccc@acme.com> r+a1BDtaD1nAZwAAstsg1A Saved)

============== External (getmail fetched)send/delivery logs excerpt

May  7 21:03:30 mailserver spamd[12785]: spamd: processing message <1543512083.4170338.1494180143705@mail.yahoo.com> for amavis:991
May  7 21:03:33 mailserver spamd[12785]: spamd: clean message (0.3/5.0) for amavis:991 in 3.5 seconds, 2790 bytes.
May  7 21:03:33 mailserver spamd[12785]: spamd: result: . 0 - BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FORGED_MUA_MOZILLA,FREEMAIL_FROM,HTML_MESSAGE,RCVD_IN_DNSWL_NONE,RP_MATCHES_RCVD,SPF_PASS scantime=3.5,size=2790,user=amavis,uid=991,required_score=5.0,rhost=localhost,raddr=::1,rport=41200,mid=<1543512083.4170338.1494180143705@mail.yahoo.com>,bayes=0.000000,autolearn=no autolearn_force=no
May  7 21:03:33 mailserver spamd[12783]: prefork: child states: II
May  7 21:03:33 mailserver dovecot: lda(bbb@acme.com): sieve: msgid=<1543512083.4170338.1494180143705@mail.yahoo.com>: stored mail into mailbox 'INBOX'

I noticed that locally, the mails are delivered via lmtp, but getmail’s mda_external is dovecot-lda. I dont know whether this has anything to do with it (I dont know how to set mda_external to lmtp, so I wasnt able to test using it)

I hope I have provided sufficient info

Regards,

Clemo.

If Getmail delivers messages with dovecot-lda aliases and forwards are bypassed because they are implemented by Postfix.

I’m pretty sure a similar request has been done in the past and it has been solved by passing messages to postfix. However re-injecting delivered messages in the SMTP loop is dangerous and could cause bounces.

Here:

I experienced the SMTP loop when trying to re-inject via postfix (sendmail.postfix).

I guess I have to go back to Fetchmail (Its working perfectly with aliases and forwards).

Thanks all for the assistance.

Clemo

1 Like

Had the same problem: created a multidrop receiver but mail didn’t get accepted when it was for an alias.

Solved it with a multisorter destination in the getmail config:

[retriever]
type = MultidropPOP3SSLRetriever
server = pop.mail.nl
username = ***@mail.nl
password = ***
envelope_recipient = delivered-to:2

[destination]
type = MultiSorter
default = [aaa-default]
locals = (
(‘bbb’, ‘[bbb]’),
(‘aliasforbbb@’, ‘[bbb]’),
(‘ccc@’, ‘[ccc]’)
)

[aaa-default]
type = MDA_external
path = /usr/libexec/dovecot/dovecot-lda
arguments = ("-e","-d","aaa@local.net")
user = vmail
group = vmail

[bbb]
type = MDA_external
path = /usr/libexec/dovecot/dovecot-lda
arguments = ("-e","-d","bbb@local.net")
user = vmail
group = vmail

[ccc]
type = MDA_external
path = /usr/libexec/dovecot/dovecot-lda
arguments = ("-e","-d","ccc@local.net")
user = vmail
group = vmail

Hope this will help someone (and maybe something to include in the pop3 connector config menu in the future)

1 Like

I like your example, its such that by just looking at it I understood how to create a Getmail MultiSorter config.

However I believe applying this to over hundred accounts would be cumbersome. If I am not wrong there has to be a config for each account, isnt it ?