如何从Gmail下载所有带有附件的电子邮件?

如何连接到Gmail并确定哪些邮件带有附件?然后,我想下载每个附件,并在处理邮件时打印出主题:和发件人:。



GCT1015
浏览 2126回答 3
3回答

翻翻过去那场雪

看看Mail :: Webmail :: Gmail:获取附件有两种获取附件的方法:1->通过发送对由...返回的特定附件的引用 get_indv_email# Creates an array of references to every attachment in your accountmy $messages = $gmail->get_messages();my @attachments;foreach ( @{ $messages } ) {    my $email = $gmail->get_indv_email( msg => $_ );    if ( defined( $email->{ $_->{ 'id' } }->{ 'attachments' } ) ) {        foreach ( @{ $email->{ $_->{ 'id' } }->{ 'attachments' } } ) {            push( @attachments, $gmail->get_attachment( attachment => $_ ) );            if ( $gmail->error() ) {                print $gmail->error_msg();            }        }    }}2->或通过发送附件ID和邮件ID#retrieve specific attachmentmy $msgid = 'F000000000';my $attachid = '0.1';my $attach_ref = $gmail->get_attachment( attid => $attachid, msgid => $msgid );(返回对包含附件中数据的标量的引用。)
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

Java
Python