0.0
No commit activity in last 3 years
No release in over 3 years
Enables extra meta data options for TMail::Mail objects
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
 Dependencies
 Project Readme

TMail Meta Data Functionality¶ ↑

Allows you to include extra data within the body of e-mail messages for use in automated parsing through TMail.

Settings¶ ↑

If you need to override the default scanner you can run this:

TMail::Metas.scanner = /Metas\((.*)\)/
TMail::Metas.scanner_options = {:seperator => ':', :group_seperator => ','}

# which will look for this:
# Metas(project_id:12,type:message)

Example¶ ↑

%w{pp rubygems tmail tmail_metas}.each { |lib| require lib }

EMAIL = <<-end
To: you@example.com
From: me@example.com
Subject: This is my automated email

This is an email which will be automatically handled by a ruby script!
The body will be stripped of these meta tags while they are made available
in the mail.metas hash.

{{project_id=12345&category=Incoming Emails&create=message}}

end

mail = TMail::Mail.parse(EMAIL)

pp mail.metas # => {"category"=>"Incoming Emails", "project_id"=>"12345", "create"=>"message"}
pp mail.body  # => (body with the {{...}} metas stripped)