Skip to content

michaelstalker/mail_parser

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 

Repository files navigation

Welcome to GangstaMail

This is a simple email parser. It is primarily for demonstration purposes, as it makes some assumptions for the sake of simplicity. Some of these assumptions are faulty.

Usage

Require the necessary files in your project, and instantiate a new Email object:

email = GangstaMail::Email.new(your_raw_email_text)

You can then access the email fields through the accessor methods and instance methods of your new email object.

Assumptions

  • We don’t need to optimize for speed.

  • Email body is separated from header by one blank line.

  • There are no multi-line fields in email header.

  • There’s only one Received field. The code shouldn’t break if there are. several Received fields, but I’m not keeping track of them all.

  • We don’t need to access every field in the email header.

  • The raw email does not start with sevaral newline characters.

Things I’d Focus on Next

  • Create a command-line interface to read text files with the raw email text

  • Separate name from email address in To: and From: fields

  • Handle multi-line values in header

  • Handle different MIME parts in the body

  • Parse nested parts of body

  • Handle attachments

I’d also gemify this code to make it easier for people to use.

About

Sample email parser

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages