Re: Retrieve inbox contents and email body

2021-07-07 Thread Wim
On Wednesday, 07 July at 08:38, Jean Louis wrote:

>
> > The context is that I just would like to send emails and check for
> > responses in a more precise and quick way than opening my inbox. I would
> > like to have commands at my disposal when I am working on something to just
> > send an email directly and later check for responses to that email, or
> > check for all new emails from a particular sender. That info would need to
> > come back as the output of commands, to stdout.
>
> How I understand it is that you wish to automatically verify the
> existence at IMAP server of responses to particular email address.
>
> In almost every GNU/Linux distribution there shall be package with GNU
> Mailutils https://www.mailutils.org and inside there is one program
> named `from', that has among others the following option:
>
>   -s, --sender=ADDRESS   print only mail from addresses containing the
>  supplied string
>
> What is interesting is that it will work not only with local mail but
> it can work with remote server. For help just write to
> bug-mailut...@gnu.org mailing list even without subscription.
>

There's also mblaze which is a set of Unix utilities for processing and
interacting with mail messages which are stored in maildir folders.

>
> --
> Jean
>
> Take action in Free Software Foundation campaigns:
> https://www.fsf.org/campaigns
>
> In support of Richard M. Stallman
> https://stallmansupport.org/

--
  |\  _,,,---,,_
ZZZzz /,`.-'`'-.  ;-;;,_
 |,4-  ) )-,_. ,\ (  `'-'
'---''(_/--'  `-'\_)


Re: Retrieve inbox contents and email body

2021-07-07 Thread Julius Hamilton
Thanks.
There is a lot of good stuff here to look into.
I think I will try with grepmail first.
I was wondering what the simplest way to send an email might be - the
mentioned "mail" unix utility, perhaps?

Thanks very much,
Julius



On Tue, Jul 6, 2021, 19:33 Jon LaBadie  wrote:

> On Tue, Jul 06, 2021 at 06:19:54PM +0200, Julius Hamilton wrote:
> >Thanks very much.
> >
> >I am now looking into using a Python IMAP library.
> >
> >However, I think there must be a way to just dump the contents of a Mutt
> >page, and that could be an easier short-term solution.
> >You mentioned there being a print function.
> >Could you provide an example of using that to print the inbox to stdout?
> It
> >would have to be automatic, i.e. not requiring the user to actually open
> >Mutt themselves and type the print command. So that leads me to the
> >question of if this command can somehow be passed to mutt as a command
> line
> >option, or if there is some bash automation tool for calling it inside
> Mutt
> >anyway.
> >
> >The context is that I just would like to send emails and check for
> >responses in a more precise and quick way than opening my inbox. I would
> >like to have commands at my disposal when I am working on something to
> just
> >send an email directly and later check for responses to that email, or
> >check for all new emails from a particular sender. That info would need to
> >come back as the output of commands, to stdout.
> >
> >Thanks very much,
> >Julius
>
> If looking at separate programs, what about "grepmail"?
>
> Ex.grepmail -h -B -e '^Subject: ' 
>
> -h (grep only headers)
> -B (print body with limited headers)
>
> jon
>
> --
> Jon H. LaBadie j...@labadie.us
>   11226 South Shore Rd.  (703) 787-0688 (H)
>   Reston, VA  20190  (703) 935-6720 (C)
>


Re: Retrieve inbox contents and email body

2021-07-07 Thread Jean Louis
* Julius Hamilton  [2021-07-07 20:27]:
> Thanks.
> There is a lot of good stuff here to look into.
> I think I will try with grepmail first.
> I was wondering what the simplest way to send an email might be - the
> mentioned "mail" unix utility, perhaps?

Mutt is the way.

Use whatever you have available. If you have sendmail, you can echo
email message and use sendmail.

You can connect to SMTP server and send email from command line by
using raw connection commands.

Description : Swiss Army Knife SMTP; Command line SMTP testing, including 
TLS and AUTH
URL : https://jetmore.org/john/code/swaks/

I am using GNU Mailutils' program `mail' so often, and I send emails
by using Emacs Lisp library and Common Lisp library for `mail':

Emacs Lisp: rcd-mail.el package as bindings to GNU Mailutils "mail" program
https://hyperscope.link/3/8/3/0/3/rcd-mail-el-GNU-Mailutils-mail-program.html

I have tried using mutt as batch in the same manner, I could maybe
rewrite it for mutt. Mutt does some things in batch mode better than
`mail' maybe some features are missing.

-- 
Jean

Take action in Free Software Foundation campaigns:
https://www.fsf.org/campaigns

In support of Richard M. Stallman
https://stallmansupport.org/


Re: Retrieve inbox contents and email body

2021-07-07 Thread Julius Hamilton
Unfortunately, I have been trying to get going with some simple tools like
grepmail and mail and I can't find an answer to a simple question I have.

How are these tools configured? It seems like grepmail looks in mailbox
directories already saved in your filesystem, instead of there being some
kind of configuration file or .rc file where you put in your IMAP and SMTP
info. So I would need to already have downloaded a mailbox onto my system.
I assume the mail tool would permit that. But I have also not been able to
find how to pass my configuration information to mail. The docs seem to
assume the information is present as environmental variables, and it just
shows commands you can call to send mail, for example.

Could anyone provide me with some simple steps to download my Gmail inbox
to my filesystem as a mailbox, so that I could grepmail through it? I did
read that the mailbox could be saved to var/mail or just $HOME. In either
case I think grepmail can search for it and find it.

Thanks very much and sorry for my simple confusion. Any help is really
appreciated.

Best regards,
Julius



On Wed, Jul 7, 2021, 19:46 Jean Louis  wrote:

> * Julius Hamilton  [2021-07-07 20:27]:
> > Thanks.
> > There is a lot of good stuff here to look into.
> > I think I will try with grepmail first.
> > I was wondering what the simplest way to send an email might be - the
> > mentioned "mail" unix utility, perhaps?
>
> Mutt is the way.
>
> Use whatever you have available. If you have sendmail, you can echo
> email message and use sendmail.
>
> You can connect to SMTP server and send email from command line by
> using raw connection commands.
>
> Description : Swiss Army Knife SMTP; Command line SMTP testing,
> including TLS and AUTH
> URL : https://jetmore.org/john/code/swaks/
>
> I am using GNU Mailutils' program `mail' so often, and I send emails
> by using Emacs Lisp library and Common Lisp library for `mail':
>
> Emacs Lisp: rcd-mail.el package as bindings to GNU Mailutils "mail" program
>
> https://hyperscope.link/3/8/3/0/3/rcd-mail-el-GNU-Mailutils-mail-program.html
>
> I have tried using mutt as batch in the same manner, I could maybe
> rewrite it for mutt. Mutt does some things in batch mode better than
> `mail' maybe some features are missing.
>
> --
> Jean
>
> Take action in Free Software Foundation campaigns:
> https://www.fsf.org/campaigns
>
> In support of Richard M. Stallman
> https://stallmansupport.org/
>


Re: Retrieve inbox contents and email body

2021-07-07 Thread ಚಿರಾಗ್ ನಟರಾಜ್
12021/04/27 06:64.00 ನಲ್ಲಿ, Julius Hamilton  ಬರೆದರು:
> Unfortunately, I have been trying to get going with some simple tools like
> grepmail and mail and I can't find an answer to a simple question I have.
> 
> How are these tools configured? It seems like grepmail looks in mailbox
> directories already saved in your filesystem, instead of there being some kind
> of configuration file or .rc file where you put in your IMAP and SMTP info. So
> I would need to already have downloaded a mailbox onto my system. I assume the
> mail tool would permit that. But I have also not been able to find how to pass
> my configuration information to mail. The docs seem to assume the information
> is present as environmental variables, and it just shows commands you can call
> to send mail, for example.
> 
> Could anyone provide me with some simple steps to download my Gmail inbox to 
> my
> filesystem as a mailbox, so that I could grepmail through it? I did read that
> the mailbox could be saved to var/mail or just $HOME. In either case I think
> grepmail can search for it and find it.
> 
> Thanks very much and sorry for my simple confusion. Any help is really
> appreciated.
> 
> Best regards,
> Julius

I wrote this up a while back and it should be helpful: 
https://web.archive.org/web/20210121103233/https://chiraag.me/blog/2019/08/21/managing-multiple-email-accounts-with-mutt-and-fetchmail/

It's basically the same system I currently use with a bunch of different 
accounts from different providers.

I'm more than happy to help debug and/or answer questions!

Sincerely,

Chiraag
-- 
ಚಿರಾಗ್ ನಟರಾಜ್
Pronouns: he/him/his


publickey - mailinglist@chiraag.me - b0c8d720.asc
Description: application/pgp-keys


signature.asc
Description: OpenPGP digital signature


Re: Retrieve inbox contents and email body

2021-07-07 Thread Greg Marks
> I would like to retrieve the contents of my inbox - the emails'
> metadata, sender, subject, date - to stdout, rather than by opening
> an application.  Can Mutt dump the inbox page? Does it have any way
> to return to stdout information about the inbox? Or should I use a
> different tool for this?

This doesn't entirely do what you want, and it doesn't involve mutt;
however, the command

   frm -s new /var/mail/$(whoami)

will output the "From" and "Subject" lines of all unread messages
in /var/mail/$(whoami) to standard output.  Or, if you just want the
"From" lines:

   frm -f From -s new /var/mail/$(whoami)

There is documentation here:

   https://mailutils.org/manual/mailutils.txt

As I recall, the OP was interested in being notified upon arrival of
a response to an e-mail he sent.  For this, perhaps

   for ((;;)) ; do sleep 60 ; frm -f From -s new /var/mail/$(whoami) ; done

is suitable to check for a response every minute.  This can of course
be modified to display only e-mails from a particular sender:

   for ((;;)) ; do sleep 60 ; frm -f From -s new /var/mail/$(whoami) | egrep -n 
-e 'friend@example\.org' ; done

Best regards,
Greg Marks


signature.asc
Description: PGP signature


Re: Retrieve inbox contents and email body

2021-07-07 Thread Jean Louis
* Julius Hamilton  [2021-07-07 22:57]:
> Could anyone provide me with some simple steps to download my Gmail inbox
> to my filesystem as a mailbox, so that I could grepmail through it? I did
> read that the mailbox could be saved to var/mail or just $HOME. In either
> case I think grepmail can search for it and find it.

I use the program `movemail' from GNU Mailutils package to download it
offline.

-- 
Jean

Take action in Free Software Foundation campaigns:
https://www.fsf.org/campaigns

In support of Richard M. Stallman
https://stallmansupport.org/


Re: Retrieve inbox contents and email body

2021-07-07 Thread Jon LaBadie

On Wed, Jul 07, 2021 at 09:56:10PM +0200, Julius Hamilton wrote:

Unfortunately, I have been trying to get going with some simple tools like
grepmail and mail and I can't find an answer to a simple question I have.

How are these tools configured? It seems like grepmail looks in mailbox
directories already saved in your filesystem, instead of there being some
kind of configuration file or .rc file where you put in your IMAP and SMTP
info. So I would need to already have downloaded a mailbox onto my system.


Well the manpage you read says a required argument to grepmail is 
"file(s)".  That sounds local to me.



Could anyone provide me with some simple steps to download my Gmail inbox
to my filesystem as a mailbox, so that I could grepmail through it? I did
read that the mailbox could be saved to var/mail or just $HOME. In either
case I think grepmail can search for it and find it.


Didn't know, I have google send my gmail to my home account.

I expected you could just select the desired gmail messages and download 
them.  Found out you can only do single messages that way.


Asking google how to do it got me to takeout.google.com.  Google lets
you download all your data throught "takeout".  Its a little clumsy,
but if you deselect all and reselect just "mail", you can download
all your gmail (trash, spam, and archive included :)).

jl

--
Jon H. LaBadie mut...@jgcomp.com
 11226 South Shore Rd.  (703) 787-0688 (H)
 Reston, VA  20190  (703) 935-6720 (C)


Re: Retrieve inbox contents and email body

2021-07-07 Thread Jean Louis
* Jon LaBadie  [2021-07-08 08:37]:
> > Could anyone provide me with some simple steps to download my Gmail inbox
> > to my filesystem as a mailbox, so that I could grepmail through it? I did
> > read that the mailbox could be saved to var/mail or just $HOME. In either
> > case I think grepmail can search for it and find it.
> 
> Didn't know, I have google send my gmail to my home account.
> 
> I expected you could just select the desired gmail messages and download
> them.  Found out you can only do single messages that way.
> 
> Asking google how to do it got me to takeout.google.com.  Google lets
> you download all your data throught "takeout".  Its a little clumsy,
> but if you deselect all and reselect just "mail", you can download
> all your gmail (trash, spam, and archive included :)).

- Use Google IMAP server

- Use `movemail' or `fetchmail' or `imapsync' to synchronize with
  computer


-- 
Jean

Take action in Free Software Foundation campaigns:
https://www.fsf.org/campaigns

In support of Richard M. Stallman
https://stallmansupport.org/


Re: Retrieve inbox contents and email body

2021-07-07 Thread Jean Louis
* Julius Hamilton  [2021-07-07 22:57]:
> Unfortunately, I have been trying to get going with some simple tools like
> grepmail and mail and I can't find an answer to a simple question I
> have.

I recommend that you re-phrase the simple question.

How I have understood, you wish to see if there are some emails on the
remote IMAP server related to specific recipient or sender. Is it?


-- 
Jean

Take action in Free Software Foundation campaigns:
https://www.fsf.org/campaigns

In support of Richard M. Stallman
https://stallmansupport.org/