Curl not marking mail as read!!
Hi All,
I am trying to write a script which respond to all the mails received on my gmail account. I am able to get the sender's email address successfully using curl (check below). But the problem here is, this is not marking the mail as read and/or it is fetching all the email addresses everytime the script runs. Is there anyway i can make curl to fetch only the new mails and once only. *#!/bin/bash* * * *var=$(curl -u gmail_username:gmail_password --silent ' https://mail.google.com/mail/feed/atom' | tr -d ' ' | awk -F '<entry>' '{for (i=2; i<=NF; i++) {print $i}}' | sed -n 's/<title>(.*)</title.*email>(.*)</email>.*/2 /p')* * * *for i in $var* *do* *echo $i* *done* Please suggest. Thanks for help. Raj -- redhat-list mailing list unsubscribe mailto:redhat-list-request@redhat.com?subject=unsubscribe https://www.redhat.com/mailman/listinfo/redhat-list |
Curl not marking mail as read!!
On Mon, Aug 20, 2012 at 3:44 PM, raj sourabh <rajsourabh1@gmail.com> wrote:
> Is there anyway i can make curl to fetch only the new mails and once only. It looks like the atom feed is read-only, you'd have to sign in and mark the messages as read if you wanted to remove them from the feed. You'll either have to keep track of the messages you've sent a message to, or use something other than the read-only feed to get a list of email addresses. How about writing a script that uses POP or IMAP? -- Jonathan Billings <jsbillin@umich.edu> College of Engineering - CAEN - Unix and Linux Support -- redhat-list mailing list unsubscribe mailto:redhat-list-request@redhat.com?subject=unsubscribe https://www.redhat.com/mailman/listinfo/redhat-list |
Curl not marking mail as read!!
Thanks for your response. Well I tried writing a script in perl using
POP3client module. The below script works but I am not able to fetch the senders email address. ("From" tag prints the name of the sender, not the mail :( ) *#!/usr/bin/perl -w* *use strict;* *use Mail::POP3Client;* * * *my $user = 'username';* *my $pass = 'password';* * * *my $pop = new Mail::POP3Client(* * USER => $user,* * PASSWORD => $pass,* * HOST => "pop.gmail.com",* * PORT => 995,* * USESSL => 'true',* *);* *print "Content-type: text/html ";* *my $count = $pop->Count();* *if ($count < 0) {* * print $pop->Message();* *} elsif ($count == 0) {* * print "no messages ";* *} else {* *# print "$count messsages ";* * * * for my $i (1 .. $count) {* * foreach ($pop->Head($i)) {* * print "$_ " if /^(From):/i;* * }* * print " ";* * }* *}* * * *$pop->Close();* On Mon, Aug 20, 2012 at 11:55 PM, Jonathan Billings <jsbillin@umich.edu>wrote: > On Mon, Aug 20, 2012 at 3:44 PM, raj sourabh <rajsourabh1@gmail.com> > wrote: > > Is there anyway i can make curl to fetch only the new mails and once > only. > > It looks like the atom feed is read-only, you'd have to sign in and > mark the messages as read if you wanted to remove them from the feed. > You'll either have to keep track of the messages you've sent a message > to, or use something other than the read-only feed to get a list of > email addresses. How about writing a script that uses POP or IMAP? > > -- > Jonathan Billings <jsbillin@umich.edu> > College of Engineering - CAEN - Unix and Linux Support > > -- > redhat-list mailing list > unsubscribe mailto:redhat-list-request@redhat.com?subject=unsubscribe > https://www.redhat.com/mailman/listinfo/redhat-list > -- redhat-list mailing list unsubscribe mailto:redhat-list-request@redhat.com?subject=unsubscribe https://www.redhat.com/mailman/listinfo/redhat-list |
| All times are GMT. The time now is 02:59 PM. |
VBulletin, Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.