Created
June 20, 2012 14:26
-
-
Save dvinciguerra/2960156 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl -w | |
use strict; | |
use Mail::Internet; | |
my $mail = Mail::Internet->new(\*STDIN); | |
# carrega informações | |
my $from = $mail->head->get("From") || ""; | |
my $subject = $mail->head->get("Subject")|| ""; | |
my $body = join("", @{$mail->body}) || ""; | |
# limpa o corpo da mensagem | |
$body =~ s/^--[0-9a-zA-Z]*$//gi; # remove linha com hash | |
$body =~ s/^Content-Type:(.+)$//gi; # remove linha content-type | |
open my $file, ">/tmp/teste-perl.txt" or die $!; | |
print $file qq{ | |
$from | |
$subject | |
$body | |
}; | |
close $file; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment