Re: problems with decoding: resulting image is corrupt
From: Bjorn Jensen (b.d.jen_removethissen_at_gmxandthis.net)
Date: 03/22/05
- Next message: jjasonclark_at_spamless.gmail.com: "How to match up to a word"
- Previous message: Bjorn Jensen: "Accessing email from Notes-mail-server without Lotus Notes installed"
- In reply to: Bjorn Jensen: "problems with decoding: resulting image is corrupt"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Tue, 22 Mar 2005 19:52:44 +0100
Hi again!
Oh, of course - I tried binary(UD) yesterday but this gave error.'
Now it works - thanks!
Now I'll look for a better way to extract attachments.
I try to figure out, how to use
Email::MIME::Attachment::Stripper;
but have no success...
The documentation is spare.
Any good example, that I can use for expanding my case below?
Greetings Bjørn
"Bjorn Jensen" <b.d.jen_removethissen@gmxandthis.net> wrote in message
news:423f4850$0$13726$ba624c82@nntp03.dk.telia.net...
> Hello!
> My resulting image har nearly same size of original (but not exact) and
the
> nu.jpg can be shown,
> but it is modified so much, that it look totally different.... why? what
to
> do?
> Greetings Bjorn!
>
> ============================
> use strict;
> use Net::POP3;
> use MIME::Base64;
>
> my $username = 'user1';
> my $password = 'userpw';
> my $pop = Net::POP3->new('mailme.org', Timeout => 60);
>
> if ($pop->login($username, $password) > 0) {
> my $msgnums = $pop->list; # hashref of msgnum => size
> foreach my $msgnum (keys %$msgnums) {
> my $mailfile = 'mail'.$msgnum.".txt";
> open(M, ">$mailfile") or die "Error\tCouldn't open $mailfile, $!";
> print "msg $msgnum\n";
> my $msg = $pop->get($msgnum);
> #print @$msg;
> print M @$msg;
> #$pop->delete($msgnum);
> close(M);
> }
> }
>
> $pop->quit;
> my $b64str;
> open(UD, ">nu.jpg") or die "$!";
>
> open(IND, "<mail2.txt") or die "$!";
> my $part2decode = 0;
> my $line = 0;
>
> while(<IND>) {
> if ( /Content-Disposition/i ) {
> $part2decode++;
> }
> if ( $part2decode ) {
> $line++;
> }
> if ( /Boundary/ ) {
> $part2decode = 0;
> }
> if ( $part2decode && $line > 1 ) {
> my $encoded = $_;
>
> my $decoded = decode_base64($encoded);
> print UD $decoded;
> }
> }
> close(UD);
> close(IND);
>
>
>
>
>
>
- Next message: jjasonclark_at_spamless.gmail.com: "How to match up to a word"
- Previous message: Bjorn Jensen: "Accessing email from Notes-mail-server without Lotus Notes installed"
- In reply to: Bjorn Jensen: "problems with decoding: resulting image is corrupt"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]