Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I parse E-Mail contents

How to parse the Email into sections like, header, body, attachment, and sender and receiver? I would like to use Perl or Perl Moose?

like image 296
jubf Avatar asked Apr 07 '11 03:04

jubf


People also ask

What does it mean to parse emails?

Email parsing is the process of using software to look for and extract specific data in an email to avoid manual data entry. Things like order numbers, leads, contact details and more can be found in emails. The challenge with email parsing is that emails are designed for humans, not for machines.


1 Answers

see Mail::Message - general message object something like,

my $msg =Mail::Message->new($mail);
my $body    = $msg->body;
my @to      = $msg->to;
my @from    = $msg->from;

or see Email::Simple - simple parsing of RFC2822 message format and headers.

Updated:

see also Email::MIME - Easy MIME message parsing.

like image 155
Nikhil Jain Avatar answered Oct 03 '22 01:10

Nikhil Jain