Mail::Webmail::Gmail

Available on cpan – Mail::Webmail::Gmail

This module gives the ability to do almost anything with Gmail programmatically through perl.

Thanks for all the hardwork and effort in getting this back up and working! I’ve been swamped and havent been able to do some maintenance on this module in a bit. Hopefully I will be able to incorporate these change into the main tree soon.

17 Responses to “Mail::Webmail::Gmail”

  1. 1
    Siddharth Uppal Says:

    Very cool! Great work!

  2. 2
    bistouri Says:

    Additionally, there’s a python script useful to store files on a Gmail account called “GmailFS” . I tested it on Linux and Windows and found it great. Have a look at http://libgmail.sourceforge.net and http://richard.jones.name/google-hacks/gmail-filesystem/gmail-filesystem.html

  3. 3
    Frederik Vanrenterghem Says:

    This is nice! Would you be willing to incorporate what you have here in a local SMTP server, so one can use his own mail program to send mails through gmail, without having to rely on SMTP? That would be somewhat like whathttp://www.lightningsp.com/modules/mydownloads/singlefile.php?cid=6&lid=8 does, but better… I’m trying to do that because my handheld is connected to a wireless network that only allows proxied HTTP(S) traffic.

  4. 4
    karu Says:

    Hi there, I made some modification to add a edit_filters method that allows creating filters. Let me know if you want to incorporate this and make an updated release. I can mail you the source I have.

  5. 5
    Ben Hood Says:

    Have any users had problems with the DOS attack protection? I debugged the module and found out that I was being challenged to interpret an automatically generated image. I would like to patch this, as I can’t use the module without it, but before I do, I’m just wondering if (a) anybody else has had this problem and (b) whether the error handling in the login method needs to be generalized

  6. 6
    Julien Says:

    Is anyone seen that module not working now ? I tested it with the example script and correct credentials, without success.

    Julien

  7. 7
    Matthew Says:

    It seems something has changed at the Gmail end, because as from September 9th the Mail::Webmail::Gmail module is no longer working.

  8. 8
    Julien Says:

    In fact, cookie are not forwarded from the first GET http://mail.google.com/mail to the GET https://www.google.com/accounts/...

    I checked in the LWP::UserAgent code, in the request sub. In fact, that is normal, the following code comes from it :

    # These headers should never be forwarded
    $referral->remove_header(‘Host’); ‘Cookie’);

    Dont’ know why, as I’m no HTTP header expert.

    To be sure, I changed the LWP::UserAgent code (!) to make Cookie header be forwarded and … that worked.

    Any hint ?

    Kind regards

    Julien

  9. 9
    Thanh Says:

    Hi Julien,

    I also use Mail::Webmail::Gmail to send mail and it stopped working a few days ago. I have no idea how to fix it, as I am nor a web neither a perl programmer, but I would like to have a workaround if possible. Can you please send me the changes you made to UserAgent.pm to make it work? I tried to comment out the line you mentioned, but it didn’t work — probably there is more than just commenting out that line.

    Thanks.

  10. 10
    Julien Says:

    Hi

    I made another comment about the other things I did, but it is still awaiting moderation. I think it was too long… Anyway, I posted the Gmail.pm I use here :

    http://www.greyhats.org/files/Gmail.pm

    Moreover, the only change I made in UserAgent.pm (from LWP) is replacing, in the request sub, the line
    $referral->remove_header(‘Host’), ‘Cookie’);
    by
    $referral->remove_header(‘Host’); #, ‘Cookie’);

    Warning : This is dirty hack, very dirty hack…

    Julien

  11. 11
    Thanh Says:

    Hi Julien,

    many thanks for the answer — it works now.

    Thanh

  12. 12
    Mudit Says:

    Hi Julien,

    I did modify the UserAgent.pm and also using Julien’s Gmail.pm. Still I’, not able to login.

    I ran the perl -d and found out that its failing at

    110: if ( $res->content() =~ // ) {
    DB
    Mail::Webmail::Gmail::login(/usr/lib/perl5/site_perl/5.6.0/Mail/Webmail/Gmail.pm:126):
    126: $self->{_error} = 1;

    Thanks
    Mudit

  13. 13
    Mudit Says:

    Nevermind .. false alarm ..
    its working now !!!!

    [I had written a request_hack function in UserAgent which has your modifications, but I forgot to call it when I copied your Gmail.pm file and overwrote my changes].

    Thanks !!

    Mudit

  14. 14
    paul Says:

    hi, Julien,

    Another question, I am using this model to delete those thousands trash mail. After delete about 60 trash emails, it seems gmail has blocked my account and the perl code does not work on the trash mail, althoug the print information shows it is still working. but the amount of trash email stopped decrease. and after I runned the perl script sereval time, gmail show this message,

    Our system indicates unusual usage of your account. In order to protect Gmail users from potentially harmful use of Gmail, this account has been disabled for up to 24 hours.

    Any comments?

    thanks.

  15. 15
    Vishu Says:

    Thanks!

    This is one of the most useful modules ever. It really helped me a lot!

  16. 16
    John Says:

    How do I retrieve ALL the messages in a conversation? It seems the examples only return the last message in a thread/conversation. Is there a way to return all individual emails?

    Otherwise, it’s a very nice implementation. Thanks!

  17. 17
    mohclips Says:

    Example Script (after much more code reading):

    This script prints the individual messages in a thread/conversation:

    my $threads = $gmail->get_messages( label => ‘perl-test-label’ );
    foreach ( @{ $threads } ) {
    my $thread = $gmail->get_indv_email( msg => $_ );
    foreach $messageid ( sort keys %{$thread}) {
    my $body = $gmail->get_mime_email( id => $messageid , label => ‘perl-test-label’ );
    print $body;
    };
    };

    The key to this is the function get_mime_email – though this basically is the same as the gmail function ‘Show original message’

    I hope this helps people.

    Best Regards.

Leave a Reply

Search

Subscribe!

Subscribe to the RSS Feed

Have a question or comment?

Send me an email - mincus@gmail.com

Most Popular

Recent Posts

Categories

Sponsors

Links

Meta

Classic Kids Games