Fetchmail first draft

Inspired from this thread I started a first draft of ns8-fetchmail which could be the pop connector of NS8 to get mails from a mailserver and send them to the local one.

Documentation: GitHub - mrmarkuz/ns8-fetchmail
Install via Software Center from repo: ns8:mrmarkuz_repository [NethServer & NethSecurity]

It’s just an alpine container with fetchmail and cron so it should be possible to use cronjobs to run fetchmail tasks. There’s no UI, it needs to be configured manually. Your configurations and logs are included in backup.

Thanks to @NLS and @Tiago for testing and providing configuration examples.
Maybe you want to test the app as you seem to have working configs.

TODO

  • Find a good configuration together
  • User Interface

BTW, there’s also a roundcube fetchmail plugin that could be interesting: Roundcube fetchmail plugin | fetchmail

9 Likes

Definitely going to try this. Will revert when I do.

3 Likes

Oh wow that’s veeery good

Episode 1 Applause GIF by Friends

1 Like

So, after way too much delay (but I am also without a server for days, only today probably having solved it’s issues - probably)… I will start using this today.

Before this, the solution I found (since NS8 is a VM inside my UNRAID), was to use a fetchmail container in UNRAID that “pushed” mail to my NS8. Was working fine.

But:

  1. That container has no support (the author hasn’t even visited UNRAID forum for months).
  2. In the meantime, since it last worked, many “cogs” of my system changed (NIC, router) - supposedly these are configured OK, but you never know, better eliminate “cogs” I cannot control.
  3. I now get some problem in that container getting email from my mail provider. I will write what here, because we might hit the same with this here.
    I have a dynamic IP at home (and always worked this way with the help of ddns, after all my mail was received by my domain host’s cpanel -and pulled by NS8- and send relayed through my ISP).
    The problem is that now for some reasons it fails like that:
550-[<current dynamic IP>]:40126 is in an RBL: Listed by PBL, see
550 https://check.spamhaus.org/query/ip/<current dynamic IP>"
Feb 28 08:57:52 fetchmail: Connection errors for this poll:
name 0: connection to localhost:smtp [127.0.0.1/25] failed: Connection refused.
Feb 28 08:57:51 fetchmail: reading message <email address>:1 of 1Feb 28 08:57:51 fetchmail:  (6855 header octets) not flushed

…but the blacklisting I suspect happens right there. It is not that by chance I use a dynamic IP that was already marked. Something is done trying to pull the messages, that black lists the IP (I tried re-connecting my router, so quite a few IP). I hope this won’t happen with this, any idea what could cause it?

Anyway, will get back to you when I configure it.

1 Like

mrmarkuz I want to try this, but have questions… I prefer to “stupid proof” things (even things I know), than mess something.

  1. What is the use of the host name I define? Is it my mail domain? Is it my NS8 (internal) domain? Is it another new host name the container uses for whatever? (what is the use?) In the last case, I need to set it in my internal DNS also?
    I currently set it to fetchmail.local.mydomain (where “local.mydomain” is used in all my internal hosts), but haven’t set it in DNS (after all, I don’t even know what IP to set).

  2. Noob question, in NS8 console (and specifically within fetchmail1 agent context, how do I create/edit the files you mention in the config? OR how to I bring the files from some other location in the network?

  3. Seeing that fetchmailrc, is well… fetchmailrc (I already have one from my UNRAID container), I suspect I will see the same errors (see post above).
    Entries for each user are like that:

poll mail.<my domain> proto IMAP
  user '<an email address>' password '<the password>' is <local user> here options ssl
  smtphost <my nethserver hostname in the form nethserver.local.mydomain>
  smtpname <same email address>

So I wonder what is the problem is.
Remember those entries used to work fine.

But before we reach this point I need to somehow create the files needed. So please help with #1 and #2 first.

Thanks.

And…

  1. I would love if you would add some GUI config. Maybe just the cron config initially and/or editing fetchmailrc (even just pasting the text is useful enough and auto-resetting the permissions of the file, no need for buttons and selectors).
2 Likes

It seems the local MTA in the container isn’t working. Is sendmail available?

Sorry, the documentation isn’t clear. The hostname doesn’t matter, I should remove it from the UI too.

Best way is to get instance user:

runagent -m fetchmail1

and create/edit the files like

nano cron/cronjob1

or

nano fetchmail/fetchmailrc

You can copy the files to the following locations via SCP for example.

Cron: /home/fetchmail1/.config/state/cron
Fetchmail: /home/fetchmail1/.config/state/fetchmail

I’m going to add an adapted UI from imapsync. More complex configs are still possible via CLI.

2 Likes

Thank you for the reply.
I figured out the issue with UNRAID container (which would probably be an issue with your plugin too) - it was a communication issue with my local DNS.

The problem with editing/creating the files is that the pre-made NS8 image, doesn’t have nano installed (I have actually not touched the pre-made image OS side, except to set networking initially). I will figure it out.
It does have scp (after all, I have a working fetchmailrc already).

My UNRAID fetchmail container now works, but I will try this anyway as I said I would (waiting for my parity rebuild etc. as I had huge different issues with my server - which for a period seems it just hated me).

Thanks again.

1 Like

20 days after my last post, were (almost) 20 days with my server off line!

I got in to an Odyssey (!) of issues which led to me replacing (gradually) everything on my server except my storage. Motherboard actually got replaced twice.

Anyway, I cannot promise anything after all. :smiley: I hope to try this eventually (for now fetchmail container works). Strangely enough, I haven’t seen much interest from others though.

1 Like