Ability to select mailbox with POP3 Connector

Hi,

getmail in Nethserver only reads the INBOX-folder. However, I really would like to be able to select other mailboxes. In getmail this can be configured using the mailbox-parameter, i.e “mailbox = INBOX.somesubfolder”. I’ve looked at the current nethserver scripts, and I think it would be a rather easy addition: add the maibox-entry-field to the POP3 Connector configuration webpage, and have it added to the script /etc/e-smith/templates/getmailrc/10retriever.
Is there somebody who actively maintains the POP3 connector and who is willing and has the time to add this feature? If not, I would not mind to add it myself, but I don’t want to step on anybody’s toes…

Kind regards,
Bart

4 Likes

I think this could be a nice enhancement!

I’d start with a simple template-custom which reads a new prop from the db, maybe something like:

Folders=folder1,folder2

What do you think?

Yes, something like that! I think it would be best if we let the user enter the hierarchical folder name, as required by IMAP and by getmail.

How about this:

If the user leaves the entry filed empty, getmail reads ALL mailboxes.

If the user enters "INBOX", getmail reads only the INBOX-folder.

If the user enters "INBOX.folder1" getmail reads folder1 which is a subfolder from INBOX.

If the user enters "INBOX.folder1, folder2.subfolderA" getmail again reads folder1, a subfolder from INBOX but also subfolderA wich is a subfolder from folder2.

Now a bold question: I would love to code this change :slight_smile: Can I just pull the sources from github and code away…? An how would my changes be merged into the main line? Would you review it, Giacomo?

Bart

3 Likes

You can fork everything from Github!
When you think you’re almost done, open a pull request and we will review it. At the end, the pull request will be merged and released inside the rpm.

Don’t be afraid to ask anything during the development process :wink:

Okay, so I forked getmail and started making the necessary changes. There is one thing I could use some help with, and that’s the script that adds the new “Mailboxes” property to all the existing user accounts in de DB. Am I correct that this functionality has to be added to etc/e-smith/events/actions/nethserver-getmail-migrate? There is already some code in there that changes existing user accounts during upgrade from Nethserver 6 to the current version, but nothing for adding new properties to existing Nethserver7-installations. Could you give me a hint how I can a add single new property?

1 Like

Hi Bart, I really appreciate your aim to jump directly into the code :slight_smile: we’ re strongly looking for people like you.
@areguera could you give some hints to this guy?

Finished! It works! :slight_smile:
I’ve just made a pull request, if I’m not mistaken that’s the next step.

3 Likes

Great job @Bart! I like your PR!

One question though: IIRC the POP3 protocol does not support a server-side folder structure. Does it work against IMAP servers only?

1 Like

Hi @davidep, yes, you are right! From the getmail documentation: "All IMAP retriever types also take the following optional parameters: mailboxes … ". Hmmm, I missed that one. I’ll see if I can improve my code. Do you know if it is possible to make the Mailbox-entry-field in the POP3 Connector webpage ‘optional’, so it is displayed only after the user has selected one of the IMAP-retreivers and is hidden if the user has chosen a POP3-retreiver? And is there maybe an other webpage with that kind of behaviour I could check out to see how it is done?

1 Like

It comes to my mind this:

I’m sure you’ll do better :wink:

:astonished:
As usual you deserve this

2 Likes

I think it’s a very cool feature.
I can help you with testing?

Ciao
Enzo

1 Like

Unfortunately, you can’t test it until @Bart doesn’t edit his PR and a new testing package is released.
Bart! There is a volunteer here :slight_smile: do you have some time?

Hi Enzo, Alessio,

Enzo, thank you for your offer to help with the testing, much appreciated! Unfortunately I’m a little busy at the moment. Please be a little bit more patient, I’ll try and do some more coding next week and try to get the feature finished!

Bart

1 Like