POP3 Connector MultiDrop mode

NethServer Version: 7.4.1708
Module: POP3 Connector

Hello All,
I’ve just installed NethServer since it’s time to replace my aging ClearOS server.

How do I set up the POP3 Connect to operate in MultiDrop mode? I’ve seen these postings:


There is mention of a new MultiDrop feature in the POP3 Connector, but this doesn’t seem to have happened, will MultiDrop ever be implemented via the GUI?

many thanks
Bob

Probably not in the coming days, but, as always, contributions are welcome.
The manual modifications needed are really simple and, given the low amount of requests for this feature, I think that using custom templates is the best way to “solve” the need.

Recap:

  1. create an account in the pop3 connector interface, let’s say info@example.org
  2. go to the command line and make it a multidrop

db getmail setprop info@example.org Retriever MultidropPOP3Retriever

  1. Create two custom templates:

    mkdir -p /etc/e-smith/templates-custom/getmailrc/
    cp -p /etc/e-smith/templates/getmailrc/20destination /etc/e-smith/templates-custom/getmailrc/
    sed -i “/OUT/s/\$name/%(recipient)/” /etc/e-smith/templates-custom/getmailrc/20destination
    echo “envelope_recipient = delivered-to:1” >/etc/e-smith/templates-custom/getmailrc/11envelope

  2. Apply config:

signal-event nethserver-getmail-update

3 Likes

@filippo_carletti many thanks for the rapid and detailed response.

But, I’ve completed the steps as you’ve told me but “signal-event nethserver-getmail-update” removes the .cfg file from /var/lib/getmail

Should the /etc/e-smith/templates-custom/getmailrc/ director have some other files in it? (Not just 20destination and 11envelope).

Many thanks
Bob

Please post output of db getmail show (mask the password).

It’s not actually a valid POP3 account, so there are no security issues. I’ve masked my actual email address though!

[root@nethserver getmail]# db getmail show
hello@here.com=getmail
Account=xxx@xxx.com
Delete=0
Password=njiojo
Retriever=MultidropPOP3Retriever
Server=123.456.789.111
SpamCheck=enabled
Time=60
Username=bob
VirusCheck=enabled
status=enabled

The only difference with my working config is that I didn’t set the Account (I think it’s obvious, mails should go to different accounts).
Please, try to remove it:

db getmail delprop hello@here.com Account

Or use the web interface.

[root@nethserver getmail]# db getmail show
hello@here.com=getmail
Delete=0
Password=njiojo
Retriever=MultidropPOP3Retriever
Server=123.456.789.111
SpamCheck=enabled
Time=60
Username=bob
VirusCheck=enabled
status=enabled

signal-event nethserver-getmail-update doesn’t generate any config file. /var/lib/getmail is empty.

This is the entry from /etc/cron.d/getmail
*/59 * * * * root /usr/bin/flock -n -E 0 /var/lib/getmail/hello@here.com.cfg

the file /var/lib/getmail/hello@here.com.cfg doesn’t exist

Thanks for your help.
Bob

I just did everything I listed above and the /var/lib/getmail/info@example.org.cfg file is there. I even removed it and signal-event re-created it.
I’m out of ideas.

That is strange.
Here’s the errors from /var/log/messages
Mar 22 17:02:55 nethserver esmith::event[7548]: ERROR in /etc/e-smith/templates-custom/getmailrc/20destination: Program fragment delivered error <<syntax error at /etc/e-smith/templates-custom/getmailrc/20destination line 10, near “$%(”>> at template line 4 Mar 22 17:02:55 nethserver esmith::event[7548]: ERROR: Template processing failed for //var/lib/getmail/hello@here.com.cfg: 1 fragment generated errors Mar 22 17:02:55 nethserver esmith::event[7548]: at /etc/e-smith/events/nethserver-getmail-update/S20nethserver-getmail-conf line 20. Mar 22 17:02:55 nethserver esmith::event[7548]: Action: /etc/e-smith/events/nethserver-getmail-update/S20nethserver-getmail-conf SUCCESS [0.113187]

This is contents of /etc/e-smith/templates-custom/getmailrc/20destination

destination]
type = MDA_external
path = /usr/libexec/dovecot/dovecot-lda
{
my $user = $account->prop(‘Account’) || ‘root’;
my ($name, $passwd) = getpwnam($user);
if ($name eq ‘’) {
$name = ‘root’;
}
$%(recipient) .= “arguments = (”-e","-d","$name")";
}
user = vmail
group = vmail

Good catch.
Discourse (the software powering this forum) ate one character in my post.
In the sed command, in front of $name there should be a backslash character (\).
Edit: discourse always eat backslashes.

sed -i “/OUT/s/\$name/%(recipient)/” /etc/e-smith/templates-custom/getmailrc/20destination

Delete the file, cp it again and re-run the sed command.
Note: I’m going to edit my post adding a second backslash.

That did it!
Forums are great (until they eat your commands)
(It’s great to get a member of NethServer dev team helping me, THANK YOU).
Regards
Bob

Let’s see if it’s worth the shot…
sed -i “/OUT/s/\\$name/%(recipient)/” /etc/e-smith/templates-custom/getmailrc/20destination
yep… ctrl+shift+c for use the syntax

OK, I’ve been trying to get GetMail working with multidrop, but I’m struggling. It’s probably best if I explain exactly what I’m trying to do.

I have 4 users: mum, dad, child1, child2
All the email goes into a single POP3 mail box at my ISP.
Each user has their own email address (e.g. mum@address.com, dad@address.com)
Every time we set up a new online account with a company, we give out a new email address (e.g. company1@address.com, company2@address.com, school@address.com, builders@address.com). My ISP allows me to drop emails sent to specific addresses, so if a company starts to send too much spam I can drop their emails.

I need to route all the unsorted emails to users mum & dad.
I then need to set up specific aliases so certain emails go to mum, e.g. school@address.com, and certain address go to dad, e.g. builders@address.com

I currently do all this with my ISP mail server by filtering the email into 4 different mailboxes and then downloading those mailboxes using FetchMail (to an old ClearOS server). I was hoping to be able to manage the whole thing using NethServer. Can I implement this using GetMail with mail aliases plus "domain accept unknown recipients"on Nethserver, or do I need to change my MX records to route mail directly to my Nethserver box and bypass my ISP mailserver (i.e. not use GetMail)?

Many thanks
Bob

The new mail address gave to the online account (e.g. builders@address.com) is an alias? Or a mailbox?

builders@address.com would be an alias of dad@address.com.

I got it all sorted in the end. Please see here: