On Tue, Jun 09, 2020 at 10:36:28AM +0200, Bastian wrote:
> On 09Jun20 09:51+0200, Kia Niskavaara wrote:
>> I'm looking for a scriptable email client for linux cli. Specifically
>> I need to connect it to a Gmail account using IMAP IDLE so that I
>> will be able to find new emails almost immediately. And secondly,
>> when new emails arrive, I need a script that automatically parse the
>> body of every email to look if they match a specific regular
>> expression - and if they match, then another script should be
>> executed.
> 
> This sounds like you are looking for a fetchmail/procmail solution. I 
> still use those since years, well already decades, in very simple way. 

Yes :)

For anyone (e.g. the OP) who might be unfamilier with the terms,
Fetchmail is an "MRA" ("Mail Retrieval Agent") and Procmail is an "MDA"
("Mail Delivery Agent").

The usual way to set things up is so that:

- The MRA retrieves mail (typically via POP3 or IMAP4) from your inbox
  on your email server, and optionally gives it to an MDA.

- The MDA applies filtering rules (and optionally invokes external mail
  filters - "milters" - like Bogofilter or SpamAssassin) and then
  delivers the emails to one or more mailboxes (e.g. mbox files or
  Maildir directories) on your hard drive.

Several MRAs (e.g. Getmail, isync, ...) have cursory MDAs built in, so
that they can at least deliver emails into local mailboxes; but for more
advanced filtering, you should use a full-blown MDA (e.g. Procmail,
which is probably the most popular MDA, or maildrop, which I would guess
is the next most popular one).


> But nowadays there are more modern and active developed projects. I
> think getmail and offlineimap are to be named here, too, but I have
> not used them.

Yes.

- Getmail will work, and many people prefer it to Fetchmail.

- Offlineimap may work.  It used to be popular, but last time I checked,
  it had a bit of a reputation for bugginess.

- I've encountered several people who prefer isync (sometimes known as
  mbsync because that's the name of its command-line tool) to
  Offlineimap: http://isync.sourceforge.net/  .  This is a powerful but
  complex tool, and you might find that Getmail is the better option.

Good luck!

-- 
A: When it messes up the order in which people normally read text.
Q: When is top-posting a bad thing?

()  ASCII ribbon campaign. Please avoid HTML emails & proprietary
/\  file formats. (Why? See e.g. https://v.gd/jrmGbS ). Thank you.

Reply via email to