MiDgArD has asked for the wisdom of the Perl Monks concerning the following question:
Hi,
How i can get the attached files of a mail message?
My CODE:
How i can get the attached files of a mail message?
My CODE:
He don't work ...#!/usr/bin/perl $homedir='/home/celflog/www/teste'; use Mail::POP3Client; use IO::File; use Mail::Message::Attachment::Stripper; $pop = new Mail::POP3Client( USER => 'myuser', PASSWORD => "mypass", HOST => "mail.server.com" ); $msg=$pop->Retrieve(1); print "$msg"; $m = Mail::Message::Attachment::Stripper->new($msg); @attachments = $m->attachments; foreach $a(@attachments) { next if $a->{content_type} !~ /jpeg|jpg/i; # Ignore invalids attached files $f = new IO::File "$homedir" . $a->{filename}, "w" or die "Can not +create file!"; print $f $a->{payload}; }
20061227 Janitored by Corion: Added code tags as per Writeup Formatting Tips
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Geting attached files of emails (POP3)
by roboticus (Chancellor) on Dec 27, 2006 at 15:48 UTC | |
by MiDgArD (Novice) on Dec 27, 2006 at 16:45 UTC | |
by roboticus (Chancellor) on Dec 27, 2006 at 17:00 UTC | |
by MiDgArD (Novice) on Dec 27, 2006 at 17:36 UTC | |
by chargrill (Parson) on Dec 27, 2006 at 18:10 UTC | |
|
Back to
Seekers of Perl Wisdom