https://github.com/mikel/mail
Ruby
A Really Ruby Mail Library
Mail.register_interceptor
You can register an object to be given every mail object that will be sent, before it is sent. So if you want to add special headers or modify any email that gets sent through the Mail library, you can do so. Your object needs to respond to a single method #delivering_email(mail) which receives the email that is about to be sent. Make your modifications directly to this object.
Edit
git clone [email protected]:mikel/mail.git
cd mail
open lib/mail/mail.rb
Contribute
# Make a new branchgit checkout -b -your-name--update-docs-Mail-register_interceptor-for-pr
# Commit to gitgit add lib/mail/mail.rbgit commit -m "better docs for Mail.register_interceptor"
# Open pull requestgem install hub # on a mac you can `brew install hub`
hub fork
git push <your name> -your-name--update-docs-Mail-register_interceptor-for-pr
hub pull-request
# Celebrate!