Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #98560

Re: Getting response by email reply message

From Tim Chase <python.list@tim.thechases.com>
Newsgroups comp.lang.python
Subject Re: Getting response by email reply message
Date 2015-11-09 16:45 -0600
Message-ID <mailman.191.1447110180.16136.python-list@python.org> (permalink)
References <79f2c622-e626-43ae-bcec-f85d394ce575@googlegroups.com> <mailman.185.1447093595.16136.python-list@python.org> <fccaef52-59bd-4165-a570-2abb6a229dbc@googlegroups.com>

Show all headers | View raw


On 2015-11-09 13:53, zljubisic@gmail.com wrote:
> > You have a couple options that occur to me:
> > 
> > 1) set up an SMTP server somewhere (or use the existing one you're
> > receiving this email at in the event you're getting it as mail
> > rather than reading it via NNTP or a web interface) to receive the
> > mail, then create a Python script to poll that inbox (usually
> > POP3 or IMAP) for messages addressed.  The mails can be
> > extracted, parsed, and deleted
> 
> Why should I setup the SMTP server? If my email is on gmail server,
> I can read the messages from there from time to time.

Thus my suggestion "or use the existing one you're receiving this
email at")

Once you have an SMTP+IMAP server like Gmail, you can use
"imaplib" (or "poplib") from the stdlib to log into your Gmail
account, pull down the messages (I presume you identify them somehow,
either by tag, sorting them into a given folder, or something in the
Subject line), and process the message body.

> For now, I could set some time interval, let's say every five
> minutes for mail checking. I could parse the mail, but at the
> moment I am not sure how mail body should look like in order to be
> sure that I have parsed the information correctly.

With imaplib/poplib, you get email.message items back.  You
can .walk() through the mime-tree extracting each part and then
searching it for whatever expression you need to determine whether
the vote was a Yes or No.

Check out the docs on
https://docs.python.org/2/library/email.message.html

-tkc


Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Getting response by email reply message zljubisic@gmail.com - 2015-11-09 08:12 -0800
  Re: Getting response by email reply message Joel Goldstick <joel.goldstick@gmail.com> - 2015-11-09 11:21 -0500
    Re: Getting response by email reply message zljubisic@gmail.com - 2015-11-09 13:45 -0800
      Re: Getting response by email reply message Laura Creighton <lac@openend.se> - 2015-11-10 06:42 +0100
        Re: Getting response by email reply message zljubisic@gmail.com - 2015-11-09 23:09 -0800
          Re: Getting response by email reply message Laura Creighton <lac@openend.se> - 2015-11-10 11:23 +0100
          Re: Getting response by email reply message Laura Creighton <lac@openend.se> - 2015-11-10 11:37 +0100
  Re: Getting response by email reply message Tim Chase <python.list@tim.thechases.com> - 2015-11-09 12:15 -0600
    Re: Getting response by email reply message zljubisic@gmail.com - 2015-11-09 13:53 -0800
      Re: Getting response by email reply message Denis McMahon <denismfmcmahon@gmail.com> - 2015-11-09 22:14 +0000
      Re: Getting response by email reply message Tim Chase <python.list@tim.thechases.com> - 2015-11-09 16:45 -0600
  Re: Getting response by email reply message Ian Kelly <ian.g.kelly@gmail.com> - 2015-11-09 15:30 -0700
    Re: Getting response by email reply message Marko Rauhamaa <marko@pacujo.net> - 2015-11-10 00:43 +0200
  Re: Getting response by email reply message Chris Angelico <rosuav@gmail.com> - 2015-11-10 09:37 +1100

csiph-web