<?xml version="1.0" encoding="utf-8"?><feed xmlns="http://www.w3.org/2005/Atom" ><generator uri="https://bridgetownrb.com/" version="2.2.2">Bridgetown</generator><link href="https://peterboling.com/feed/sanitize_email.xml" rel="self" type="application/atom+xml" /><link href="https://peterboling.com/" rel="alternate" type="text/html" /><updated>2026-11-15T23:03:36+00:00</updated><id>https://peterboling.com/feed/sanitize_email.xml</id><title type="html">Peter Boling | Sanitize_email</title><subtitle>Yet Another Paradigm by Peter Boling, featuring technical blog posts about Ruby, JavaScript, TypeScript, Go, Python, DevOps, and various open source projects. Ramblings, mumblings, cv/resume, technical blog, and documentation for many popular, and unpopular, RubyGems and other FLOSS projects, including oauth2, omniauth-identity, sanitize_email, debug_logging, flag_shih_tzu, gem_bench, etc. Semi-lifely state-of-the-petris updates.</subtitle><author><name>Peter Boling</name><email>floss@galtzo.com</email></author><entry><title type="html">sanitize_email v2.0.10 released!</title><link href="https://peterboling.com/sanitize_email/sanitize_email-v2.0.10-released!/" rel="alternate" type="text/html" title="sanitize_email v2.0.10 released!" /><published>2024-11-09T21:52:03+00:00</published><updated>2024-11-09T21:52:03+00:00</updated><id>https://peterboling.com/sanitize_email/sanitize_email-v2.0.10-released!/</id><content type="html" xml:base="https://peterboling.com/sanitize_email/sanitize_email-v2.0.10-released!/">&lt;h2 id=&quot;whats-changed&quot;&gt;What’s Changed&lt;/h2&gt;
&lt;ul&gt;
  &lt;li&gt;Prefer require relative by @pboling in https://github.com/pboling/sanitize_email/pull/123&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Full Changelog&lt;/strong&gt;: https://github.com/pboling/sanitize_email/compare/v2.0.9…v2.0.10&lt;/p&gt;</content><category term="release" /><category term="sanitize_email" /><category term="v2.0.10" /></entry><entry><title type="html">sanitize_email v2.0.9 released!</title><link href="https://peterboling.com/sanitize_email/sanitize_email-v2.0.9-released!/" rel="alternate" type="text/html" title="sanitize_email v2.0.9 released!" /><published>2024-11-09T21:50:56+00:00</published><updated>2024-11-09T21:50:56+00:00</updated><id>https://peterboling.com/sanitize_email/sanitize_email-v2.0.9-released!/</id><content type="html" xml:base="https://peterboling.com/sanitize_email/sanitize_email-v2.0.9-released!/">&lt;ul&gt;
  &lt;li&gt;Improved documentation&lt;/li&gt;
  &lt;li&gt;Add Rails 8.0 to CI&lt;/li&gt;
&lt;/ul&gt;</content><category term="release" /><category term="sanitize_email" /><category term="v2.0.9" /></entry><entry><title type="html">Preventing Accidental Emails in Development</title><link href="https://peterboling.com/sanitize_email/preventing-accidental-emails-in-development/" rel="alternate" type="text/html" title="Preventing Accidental Emails in Development" /><published>2024-09-20T14:00:00+00:00</published><updated>2024-09-20T14:00:00+00:00</updated><id>https://peterboling.com/sanitize_email/preventing-accidental-emails-in-development/</id><content type="html" xml:base="https://peterboling.com/sanitize_email/preventing-accidental-emails-in-development/">&lt;p&gt;Learn how to use sanitize_email to prevent accidentally sending emails to real users during development.&lt;/p&gt;

&lt;h2 id=&quot;the-problem&quot;&gt;The Problem&lt;/h2&gt;

&lt;p&gt;During development, you might accidentally send emails to real users. This can be embarrassing and potentially harmful.&lt;/p&gt;

&lt;h2 id=&quot;the-solution&quot;&gt;The Solution&lt;/h2&gt;

&lt;p&gt;sanitize_email intercepts and sanitizes all emails in non-production environments.&lt;/p&gt;

&lt;div class=&quot;language-ruby highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c1&quot;&gt;# config/initializers/sanitize_email.rb&lt;/span&gt;
&lt;span class=&quot;no&quot;&gt;SanitizeEmail&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;Config&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;configure&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;do&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;config&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;|&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;config&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;ss&quot;&gt;:sanitized_to&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&apos;dev@example.com&apos;&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;config&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;ss&quot;&gt;:sanitized_cc&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&apos;dev@example.com&apos;&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;config&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;ss&quot;&gt;:sanitized_bcc&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;kp&quot;&gt;nil&lt;/span&gt;
  
  &lt;span class=&quot;n&quot;&gt;config&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;ss&quot;&gt;:use_actual_email_prepended_to_subject&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;kp&quot;&gt;true&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;config&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;ss&quot;&gt;:use_actual_environment_prepended_to_subject&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;kp&quot;&gt;true&lt;/span&gt;
  
  &lt;span class=&quot;n&quot;&gt;config&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;ss&quot;&gt;:activation_proc&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;proc&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;!&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;Rails&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;env&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;production?&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;end&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;features&quot;&gt;Features&lt;/h2&gt;

&lt;ul&gt;
  &lt;li&gt;Redirects all emails to specified addresses&lt;/li&gt;
  &lt;li&gt;Preserves original recipients in subject/body&lt;/li&gt;
  &lt;li&gt;Environment-aware activation&lt;/li&gt;
  &lt;li&gt;Easy to configure and use&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Now you can develop with confidence!&lt;/p&gt;</content></entry><entry><title type="html">sanitize_email 2.0.1: Handle frozen email subjects</title><link href="https://peterboling.com/sanitize_email/sanitize_email-2.0.1-handle-frozen-email-subjects/" rel="alternate" type="text/html" title="sanitize_email 2.0.1: Handle frozen email subjects" /><published>2018-03-07T00:00:00+00:00</published><updated>2018-03-07T00:00:00+00:00</updated><id>https://peterboling.com/sanitize_email/sanitize_email-2.0.1-handle-frozen-email-subjects/</id><content type="html" xml:base="https://peterboling.com/sanitize_email/sanitize_email-2.0.1-handle-frozen-email-subjects/">&lt;p&gt;Version 2.0.1 corrects subject handling when the original subject is frozen. Email interception can modify its output without requiring the caller to provide a mutable subject string.&lt;/p&gt;

&lt;p&gt;Read the &lt;a href=&quot;https://github.com/galtzo-floss/sanitize_email/blob/main/CHANGELOG.md&quot;&gt;upstream release notes&lt;/a&gt; for the complete changes and see the &lt;a href=&quot;https://github.com/galtzo-floss/sanitize_email&quot;&gt;project repository&lt;/a&gt; for usage and installation.&lt;/p&gt;</content><category term="release" /><category term="sanitize_email" /><category term="2.0.1" /></entry><entry><title type="html">Introducing sanitize_email</title><link href="https://peterboling.com/sanitize_email/introducing-sanitize_email/" rel="alternate" type="text/html" title="Introducing sanitize_email" /><published>2009-11-10T19:07:16+00:00</published><updated>2009-11-10T19:07:16+00:00</updated><id>https://peterboling.com/sanitize_email/introducing-sanitize_email/</id><content type="html" xml:base="https://peterboling.com/sanitize_email/introducing-sanitize_email/">&lt;h2 id=&quot;an-email-condom-for-your-ruby-server&quot;&gt;An Email Condom for your Ruby Server&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://github.com/pboling/sanitize_email&quot;&gt;&lt;img src=&quot;https://img.shields.io/gem/rt/sanitize_email.svg&quot; alt=&quot;Total Downloads&quot; /&gt;&lt;/a&gt;
&lt;a href=&quot;https://github.com/pboling/sanitize_email&quot;&gt;&lt;img src=&quot;https://img.shields.io/gem/rd/sanitize_email.svg&quot; alt=&quot;Downloads Today&quot; /&gt;&lt;/a&gt;
&lt;a href=&quot;https://github.com/pboling/sanitize_email/network&quot;&gt;&lt;img src=&quot;https://img.shields.io/github/forks/pboling/sanitize_email.svg?style=social&quot; alt=&quot;Network&quot; /&gt;&lt;/a&gt;
&lt;a href=&quot;https://github.com/pboling/sanitize_email/stargazers&quot;&gt;&lt;img src=&quot;https://img.shields.io/github/stars/pboling/sanitize_email.svg?style=social&quot; alt=&quot;Stars&quot; /&gt;&lt;/a&gt;
&lt;a href=&quot;https://rubygems.org/gems/sanitize_email&quot;&gt;&lt;img src=&quot;https://img.shields.io/gem/v/sanitize_email.svg&quot; alt=&quot;Version&quot; /&gt;&lt;/a&gt;
&lt;a href=&quot;https://travis-ci.org/pboling/sanitize_email&quot;&gt;&lt;img src=&quot;https://img.shields.io/travis/pboling/sanitize_email.svg&quot; alt=&quot;Build&quot; /&gt;&lt;/a&gt;
&lt;a href=&quot;https://codeclimate.com/github/pboling/sanitize_email/maintainability&quot;&gt;&lt;img src=&quot;https://api.codeclimate.com/v1/badges/65af4948d859903a0372/maintainability&quot; alt=&quot;Maintainability&quot; /&gt;&lt;/a&gt;
&lt;a href=&quot;https://codeclimate.com/github/pboling/sanitize_email/test_coverage&quot;&gt;&lt;img src=&quot;https://api.codeclimate.com/v1/badges/65af4948d859903a0372/test_coverage&quot; alt=&quot;Test Coverage&quot; /&gt;&lt;/a&gt;
&lt;a href=&quot;http://inch-ci.org/github/pboling/sanitize_email&quot;&gt;&lt;img src=&quot;http://inch-ci.org/github/pboling/sanitize_email.svg&quot; alt=&quot;Documentation&quot; /&gt;&lt;/a&gt;
&lt;a href=&quot;https://depfu.com/github/pboling/sanitize_email&quot;&gt;&lt;img src=&quot;https://badges.depfu.com/badges/bba430e8f19a2ba3273fb20d5e8c82d6/count.svg&quot; alt=&quot;Depfu&quot; /&gt;&lt;/a&gt;
&lt;a href=&quot;https://www.codetriage.com/pboling/sanitize_email&quot;&gt;&lt;img src=&quot;https://www.codetriage.com/pboling/sanitize_email/badges/users.svg&quot; alt=&quot;Open Source Helpers&quot; /&gt;&lt;/a&gt;
&lt;a href=&quot;https://gitter.im/pboling/sanitize_email&quot;&gt;&lt;img src=&quot;https://img.shields.io/gitter/room/pboling/sanitize_email.svg&quot; alt=&quot;Chat&quot; /&gt;&lt;/a&gt;
&lt;a href=&quot;https://opensource.org/licenses/MIT&quot;&gt;&lt;img src=&quot;https://img.shields.io/badge/License-MIT-green.svg&quot; alt=&quot;License: MIT&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h1 id=&quot;sanitize_email&quot;&gt;sanitize_email&lt;/h1&gt;

&lt;p&gt;This gem allows you to override your mail delivery settings, globally or in a local context.  It is like a Ruby encrusted condom for your email server, just in case it decides to have intercourse with other servers via sundry mail protocols.&lt;/p&gt;

&lt;h2 id=&quot;summary&quot;&gt;Summary&lt;/h2&gt;

&lt;p&gt;It’s particularly helpful when you want to prevent the delivery of email (e.g. in development/test environments) or alter the to/cc/bcc (e.g. in staging or demo environments) of all email generated from your application.&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;compatible with Rails &amp;gt;= 3.X (since v1.0.5)&lt;/li&gt;
  &lt;li&gt;compatible with any Ruby app with a Mail handler that uses the &lt;code class=&quot;highlighter-rouge&quot;&gt;register_interceptor&lt;/code&gt; API (a la ActionMailer and Mail gems)&lt;/li&gt;
  &lt;li&gt;configure it and forget it&lt;/li&gt;
  &lt;li&gt;little configuration required&lt;/li&gt;
  &lt;li&gt;solves common problems in ruby web applications that use email&lt;/li&gt;
  &lt;li&gt;provides test helpers and spec matchers to assist with testing email content delivery&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;working-locally-with-production-data&quot;&gt;Working Locally with Production Data&lt;/h2&gt;

&lt;ol&gt;
  &lt;li&gt;Have a production site with live data&lt;/li&gt;
  &lt;li&gt;Dump the live data and securely transfer it to another machine (e.g. rync -e ssh)&lt;/li&gt;
  &lt;li&gt;Import it into a development database&lt;/li&gt;
  &lt;li&gt;Test features which send out email (registration/signup, order placement, etc.)&lt;/li&gt;
  &lt;li&gt;Emails get sent (in real-life!) but to sanitized email recipients&lt;/li&gt;
  &lt;li&gt;Verify what they look like when sent&lt;/li&gt;
  &lt;li&gt;Iterate on email content design&lt;/li&gt;
  &lt;li&gt;No risk of emailing production addresses&lt;/li&gt;
&lt;/ol&gt;

&lt;h2 id=&quot;re-routing-email-on-a-staging-or-qa-server&quot;&gt;Re-routing Email on a Staging or QA Server&lt;/h2&gt;

&lt;p&gt;Another very important use case for me is to transparently re-route email generated from a staging or QA server to an appropriate person.  For example, it’s common for us to set up a staging server for a client to use to view our progress and test out new features.  It’s important for any email that is generated from our web application be delivered to the client’s inbox so that they can review the content and ensure that it’s acceptable.  Similarly, we set up QA instances for our own QA team and we use &lt;a href=&quot;http://github.com/jtrupiano/rails-caddy&quot;&gt;rails-caddy&lt;/a&gt; to allow each QA person to configure it specifically for them.&lt;/p&gt;

&lt;h2 id=&quot;testing-email-from-a-hot-production-server&quot;&gt;Testing Email from a Hot Production Server&lt;/h2&gt;

&lt;p&gt;If you install this gem on a production server (which I don’t always do), you can load up script/console and override the to/cc/bcc on all emails for the duration of your console session.  This allows you to poke and prod a live production instance, and route all email to your own inbox for inspection.  The best part is that this can all be accomplished without changing a single line of your application code.&lt;/p&gt;

&lt;h2 id=&quot;using-with-a-test-suite-as-an-alternative-to-the-heavy-email_spec&quot;&gt;Using with a test suite as an alternative to the heavy email_spec&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://github.com/bmabey/email-spec&quot;&gt;email_spec&lt;/a&gt; is a great gem, with awesome rspec matchers and helpers, but it has an undeclared dependency on ActionMailer. Sad face.&lt;/p&gt;

&lt;p&gt;SanitizeEmail comes with some lightweight RspecMatchers covering most of what email_spec can do.  It will help you test email functionality.  It is useful when you are creating a gem to handle email features, or are writing a simple Ruby script, and don’t want to pull in le Rails.  SanitizeEmail has no dependencies.  Your Mail system just needs to conform to the &lt;code class=&quot;highlighter-rouge&quot;&gt;register_interceptor&lt;/code&gt; API.&lt;/p&gt;

&lt;h2 id=&quot;install-like-a-boss&quot;&gt;Install Like a Boss&lt;/h2&gt;

&lt;p&gt;In Gemfile:&lt;/p&gt;

&lt;div class=&quot;language-ruby highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;n&quot;&gt;gem&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&apos;sanitize_email&apos;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Then:&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;bundle &lt;span class=&quot;nb&quot;&gt;install&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;setup-with-ruby&quot;&gt;Setup with Ruby&lt;/h2&gt;

&lt;p&gt;&lt;em&gt;keep scrolling for Rails, but read this for a better understanding of Magic&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;There are four ways SanitizeEmail can be turned on; in order of precedence they are:&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;
    &lt;p&gt;Only useful for local context.  Inside a method where you will be sending an email, set &lt;code class=&quot;highlighter-rouge&quot;&gt;SanitizeEmail.force_sanitize = true&lt;/code&gt; just prior to delivering it.  Also useful in the console.&lt;/p&gt;

    &lt;div class=&quot;language-ruby highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt; &lt;span class=&quot;no&quot;&gt;SanitizeEmail&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;force_sanitize&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;kp&quot;&gt;true&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;# by default it is nil&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;    &lt;/div&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;If SanitizeEmail seems to not be sanitizing you have probably not registered the interceptor.  SanitizeEmail tries to do this for you. &lt;em&gt;Note&lt;/em&gt;: If you are working in an environment that has a Mail or Mailer class that uses the register_interceptor API, the interceptor will already have been registered by SanitizeEmail (however, note lack of &lt;code class=&quot;highlighter-rouge&quot;&gt;:engage =&amp;gt; true&lt;/code&gt;):&lt;/p&gt;

    &lt;div class=&quot;language-ruby highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt; &lt;span class=&quot;no&quot;&gt;Mail&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;register_interceptor&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;SanitizeEmail&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;Bleach&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;new&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;ss&quot;&gt;:engage&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;kp&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;# by default :engage is nil&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;    &lt;/div&gt;

    &lt;p&gt;Without :engage =&amp;gt; true the interceptor is inactive, and will require engaging via one of the other methods.&lt;/p&gt;

    &lt;div class=&quot;language-ruby highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt; &lt;span class=&quot;no&quot;&gt;Mail&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;register_interceptor&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;SanitizeEmail&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;Bleach&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;new&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;    &lt;/div&gt;
    &lt;p&gt;As an example you could do the following to engage SanitizeEmail:&lt;/p&gt;

    &lt;div class=&quot;language-ruby highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt; &lt;span class=&quot;no&quot;&gt;SanitizeEmail&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;Config&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;configure&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;config&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;|&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;config&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;ss&quot;&gt;:engage&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;kp&quot;&gt;true&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;    &lt;/div&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;If you don’t need to compute anything, then don’t use this option, go with the next option.&lt;/p&gt;

    &lt;div class=&quot;language-ruby highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt; &lt;span class=&quot;no&quot;&gt;SanitizeEmail&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;Config&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;configure&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;config&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;|&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;config&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;ss&quot;&gt;:activation_proc&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;Proc&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;kp&quot;&gt;true&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;# by default :activation_proc is false&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;    &lt;/div&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;This will turn it on.  Period.&lt;/p&gt;

    &lt;div class=&quot;language-ruby highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt; &lt;span class=&quot;no&quot;&gt;SanitizeEmail&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;Config&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;configure&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;config&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;|&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;config&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;ss&quot;&gt;:engage&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;kp&quot;&gt;true&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;# by default :engage is nil&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;    &lt;/div&gt;
  &lt;/li&gt;
&lt;/ol&gt;

&lt;h3 id=&quot;notes&quot;&gt;Notes&lt;/h3&gt;

&lt;p&gt;Number 1, above, is the method used by the SanitizeEmail.sanitary block.
If installed but not configured, sanitize_email DOES NOTHING.  Until configured the defaults leave it turned off.&lt;/p&gt;

&lt;h3 id=&quot;troubleshooting&quot;&gt;Troubleshooting&lt;/h3&gt;

&lt;p&gt;IMPORTANT: You may need to setup your own register_interceptor.  If sanitize_email doesn’t seem to be working for you find your Mailer/Mail class and try this:&lt;/p&gt;

&lt;div class=&quot;language-ruby highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;no&quot;&gt;Mail&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;register_interceptor&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;SanitizeEmail&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;Bleach&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;new&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;ss&quot;&gt;:engage&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;kp&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;If that causes an error you will know why sanitize_email doesn’t work.
Otherwise it will start working according to the rest of the configuration.&lt;/p&gt;

&lt;h2 id=&quot;setup-with-rails&quot;&gt;Setup With Rails&lt;/h2&gt;

&lt;p&gt;Create an initializer, if you are using rails, or otherwise configure:&lt;/p&gt;

&lt;div class=&quot;language-ruby highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;no&quot;&gt;SanitizeEmail&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;Config&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;configure&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;do&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;config&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;|&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;config&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;ss&quot;&gt;:sanitized_to&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;         &lt;span class=&quot;s1&quot;&gt;&apos;to@sanitize_email.org&apos;&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;config&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;ss&quot;&gt;:sanitized_cc&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;         &lt;span class=&quot;s1&quot;&gt;&apos;cc@sanitize_email.org&apos;&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;config&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;ss&quot;&gt;:sanitized_bcc&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;        &lt;span class=&quot;s1&quot;&gt;&apos;bcc@sanitize_email.org&apos;&lt;/span&gt;
  &lt;span class=&quot;c1&quot;&gt;# run/call whatever logic should turn sanitize_email on and off in this Proc:&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;config&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;ss&quot;&gt;:activation_proc&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;      &lt;span class=&quot;no&quot;&gt;Proc&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;sx&quot;&gt;%w(development test)&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;include?&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;Rails&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;env&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;config&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;ss&quot;&gt;:use_actual_email_prepended_to_subject&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;kp&quot;&gt;true&lt;/span&gt;         &lt;span class=&quot;c1&quot;&gt;# or false&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;config&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;ss&quot;&gt;:use_actual_environment_prepended_to_subject&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;kp&quot;&gt;true&lt;/span&gt;   &lt;span class=&quot;c1&quot;&gt;# or false&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;config&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;ss&quot;&gt;:use_actual_email_as_sanitized_user_name&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;kp&quot;&gt;true&lt;/span&gt;       &lt;span class=&quot;c1&quot;&gt;# or false&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;end&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Keep in mind, this is ruby (and possibly rails), so you can add conditionals or utilize different environment.rb files to customize these settings on a per-environment basis.&lt;/p&gt;

&lt;p&gt;But wait there’s more:&lt;/p&gt;

&lt;p&gt;Let’s say you have a method in your model that you can call to test the signup email. You want to be able to test sending it to any user at any time… but you don’t want the user to ACTUALLY get the email, even in production. A dilemma, yes?  Not anymore!&lt;/p&gt;

&lt;p&gt;To override the environment based switch use &lt;code class=&quot;highlighter-rouge&quot;&gt;force_sanitize&lt;/code&gt;, which is normally &lt;code class=&quot;highlighter-rouge&quot;&gt;nil&lt;/code&gt;, and ignored by default. When set to &lt;code class=&quot;highlighter-rouge&quot;&gt;true&lt;/code&gt; or &lt;code class=&quot;highlighter-rouge&quot;&gt;false&lt;/code&gt; it will turn sanitization on or off:&lt;/p&gt;

&lt;div class=&quot;language-ruby highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;  &lt;span class=&quot;no&quot;&gt;SanitizeEmail&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;force_sanitize&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;kp&quot;&gt;true&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;There are also two methods that take a block and turn SanitizeEmail on or off:&lt;/p&gt;

&lt;p&gt;Regardless of the Config settings of SanitizeEmail you can do a local override to force unsanitary email in any environment.&lt;/p&gt;

&lt;div class=&quot;language-ruby highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;  &lt;span class=&quot;no&quot;&gt;SanitizeEmail&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;unsanitary&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;do&lt;/span&gt;
    &lt;span class=&quot;no&quot;&gt;Mail&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;deliver&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;do&lt;/span&gt;
      &lt;span class=&quot;n&quot;&gt;from&lt;/span&gt;      &lt;span class=&quot;s1&quot;&gt;&apos;from@example.org&apos;&lt;/span&gt;
      &lt;span class=&quot;n&quot;&gt;to&lt;/span&gt;        &lt;span class=&quot;s1&quot;&gt;&apos;to@example.org&apos;&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;# Will actually be sent to the specified address, not sanitized&lt;/span&gt;
      &lt;span class=&quot;n&quot;&gt;reply_to&lt;/span&gt;  &lt;span class=&quot;s1&quot;&gt;&apos;reply_to@example.org&apos;&lt;/span&gt;
      &lt;span class=&quot;n&quot;&gt;subject&lt;/span&gt;   &lt;span class=&quot;s1&quot;&gt;&apos;subject&apos;&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;end&lt;/span&gt;
  &lt;span class=&quot;k&quot;&gt;end&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Regardless of the Config settings of SanitizeEmail you can do a local override to send sanitary email in any environment.
You have access to all the same configuration options in the parameter hash as you can set in the actual
&lt;code class=&quot;highlighter-rouge&quot;&gt;SanitizeEmail.configure&lt;/code&gt; block.&lt;/p&gt;

&lt;div class=&quot;language-ruby highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;  &lt;span class=&quot;no&quot;&gt;SanitizeEmail&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;sanitary&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;({&lt;/span&gt;&lt;span class=&quot;ss&quot;&gt;:sanitized_to&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&apos;boo@example.com&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;})&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;do&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;# these config options are merged with the globals&lt;/span&gt;
    &lt;span class=&quot;no&quot;&gt;Mail&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;deliver&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;do&lt;/span&gt;
      &lt;span class=&quot;n&quot;&gt;from&lt;/span&gt;      &lt;span class=&quot;s1&quot;&gt;&apos;from@example.org&apos;&lt;/span&gt;
      &lt;span class=&quot;n&quot;&gt;to&lt;/span&gt;        &lt;span class=&quot;s1&quot;&gt;&apos;to@example.org&apos;&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;# Will actually be sent to the override addresses, in this case: boo@example.com&lt;/span&gt;
      &lt;span class=&quot;n&quot;&gt;reply_to&lt;/span&gt;  &lt;span class=&quot;s1&quot;&gt;&apos;reply_to@example.org&apos;&lt;/span&gt;
      &lt;span class=&quot;n&quot;&gt;subject&lt;/span&gt;   &lt;span class=&quot;s1&quot;&gt;&apos;subject&apos;&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;end&lt;/span&gt;
  &lt;span class=&quot;k&quot;&gt;end&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;use-sanitize_email-in-your-test-suite&quot;&gt;Use sanitize_email in your test suite!&lt;/h2&gt;

&lt;h3 id=&quot;rspec&quot;&gt;rspec&lt;/h3&gt;

&lt;p&gt;In your &lt;code class=&quot;highlighter-rouge&quot;&gt;spec_helper.rb&lt;/code&gt;:&lt;/p&gt;

&lt;div class=&quot;language-ruby highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nb&quot;&gt;require&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&apos;sanitize_email&apos;&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;# rspec matchers are *not* loaded by default in sanitize_email, as it is not primarily a gem for test suites.&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;require&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&apos;sanitize_email/rspec_matchers&apos;&lt;/span&gt;

&lt;span class=&quot;no&quot;&gt;SanitizeEmail&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;Config&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;configure&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;do&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;config&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;|&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;config&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;ss&quot;&gt;:sanitized_to&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;         &lt;span class=&quot;s1&quot;&gt;&apos;sanitize_email@example.org&apos;&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;config&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;ss&quot;&gt;:sanitized_cc&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;         &lt;span class=&quot;s1&quot;&gt;&apos;sanitize_email@example.org&apos;&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;config&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;ss&quot;&gt;:sanitized_bcc&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;        &lt;span class=&quot;s1&quot;&gt;&apos;sanitize_email@example.org&apos;&lt;/span&gt;
  &lt;span class=&quot;c1&quot;&gt;# run/call whatever logic should turn sanitize_email on and off in this Proc.&lt;/span&gt;
  &lt;span class=&quot;c1&quot;&gt;# config[:activation_proc] =      Proc.new { true }&lt;/span&gt;
  &lt;span class=&quot;c1&quot;&gt;# Since this configuration is *inside* the spec_helper, it might be assumed that we always want to sanitize.  If we don&apos;t want to it can be easily manipulated with SanitizeEmail.unsanitary and SanitizeEmail.sanitary block helpers.&lt;/span&gt;
  &lt;span class=&quot;c1&quot;&gt;# Thus instead of using the Proc (slower) we just engage it always:&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;config&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;ss&quot;&gt;:engage&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;kp&quot;&gt;true&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;config&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;ss&quot;&gt;:use_actual_email_prepended_to_subject&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;kp&quot;&gt;true&lt;/span&gt;         &lt;span class=&quot;c1&quot;&gt;# or false&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;config&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;ss&quot;&gt;:use_actual_environment_prepended_to_subject&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;kp&quot;&gt;true&lt;/span&gt;   &lt;span class=&quot;c1&quot;&gt;# or false&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;config&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;ss&quot;&gt;:use_actual_email_as_sanitized_user_name&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;kp&quot;&gt;true&lt;/span&gt;       &lt;span class=&quot;c1&quot;&gt;# or false&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;end&lt;/span&gt;

&lt;span class=&quot;c1&quot;&gt;# If your mail system is not one that sanitize_email automatically configures an interceptor for (ActionMailer, Mail) then you will need to do the equivalent for whatever Mail system you are using:&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;# Mail.register_interceptor(SanitizeEmail::Bleach.new)&lt;/span&gt;

&lt;span class=&quot;no&quot;&gt;RSpec&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;configure&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;do&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;config&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;|&lt;/span&gt;
  &lt;span class=&quot;c1&quot;&gt;# ...&lt;/span&gt;
  &lt;span class=&quot;c1&quot;&gt;# From sanitize_email gem&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;config&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;include&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;SanitizeEmail&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;RspecMatchers&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;end&lt;/span&gt;

&lt;span class=&quot;n&quot;&gt;context&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;an email test&quot;&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;do&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;subject&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;Mail&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;deliver&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;vi&quot;&gt;@message_hash&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;it&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;should&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;have_to&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;sanitize_email@example.org&quot;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;end&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h4 id=&quot;have_-matchers&quot;&gt;have_* matchers&lt;/h4&gt;

&lt;p&gt;These will look for an email address in any of the following&lt;/p&gt;

&lt;div class=&quot;language-ruby highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;ss&quot;&gt;:from&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;:to&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;:cc&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;:bcc&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;:subject&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;:reply_to&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Example:&lt;/p&gt;

&lt;div class=&quot;language-ruby highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;n&quot;&gt;context&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;the subject line must have the email address sanitize_email@example.org&quot;&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;do&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;subject&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;Mail&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;deliver&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;vi&quot;&gt;@message_hash&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;it&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;should&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;have_subject&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;sanitize_email@example.org&quot;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;end&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h4 id=&quot;be_-matchers&quot;&gt;be_* matchers&lt;/h4&gt;

&lt;p&gt;These will look for a matching string in any of the following&lt;/p&gt;

&lt;div class=&quot;language-ruby highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;ss&quot;&gt;:from&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;:to&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;:cc&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;:bcc&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;:subject&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;:reply_to&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Example:&lt;/p&gt;

&lt;div class=&quot;language-ruby highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;n&quot;&gt;context&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;the subject line must have the string &apos;foobarbaz&apos;&quot;&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;do&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;subject&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;Mail&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;deliver&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;vi&quot;&gt;@message_hash&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;it&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;should&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;be_subject&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;foobarbaz&quot;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;end&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h4 id=&quot;have_to_username-matcher&quot;&gt;have_to_username matcher&lt;/h4&gt;

&lt;p&gt;The &lt;code class=&quot;highlighter-rouge&quot;&gt;username&lt;/code&gt; in the &lt;code class=&quot;highlighter-rouge&quot;&gt;:to&lt;/code&gt; field is when the &lt;code class=&quot;highlighter-rouge&quot;&gt;:to&lt;/code&gt; field is formatted like this:&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;highlighter-rouge&quot;&gt;Peter Boling &amp;lt;sanitize_email@example.org&amp;gt;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Example:&lt;/p&gt;

&lt;div class=&quot;language-ruby highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;n&quot;&gt;context&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;the to field must have the username &apos;Peter Boling&apos;&quot;&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;do&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;subject&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;Mail&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;deliver&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;vi&quot;&gt;@message_hash&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;it&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;should&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;have_to_username&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;Peter Boling&quot;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;end&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;non-rspec-testunit-mini-test-etc&quot;&gt;non-rspec (Test::Unit, mini-test, etc)&lt;/h3&gt;

&lt;p&gt;In your setup file:&lt;/p&gt;

&lt;div class=&quot;language-ruby highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nb&quot;&gt;require&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&apos;sanitize_email&apos;&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;# test helpers are *not* loaded by default in sanitize_email, as it is not primarily a gem for test suites.&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;require&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&apos;sanitize_email/test_helpers&apos;&lt;/span&gt;

&lt;span class=&quot;no&quot;&gt;SanitizeEmail&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;Config&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;configure&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;do&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;config&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;|&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;config&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;ss&quot;&gt;:sanitized_to&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;         &lt;span class=&quot;s1&quot;&gt;&apos;sanitize_email@example.org&apos;&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;config&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;ss&quot;&gt;:sanitized_cc&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;         &lt;span class=&quot;s1&quot;&gt;&apos;sanitize_email@example.org&apos;&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;config&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;ss&quot;&gt;:sanitized_bcc&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;        &lt;span class=&quot;s1&quot;&gt;&apos;sanitize_email@example.org&apos;&lt;/span&gt;
  &lt;span class=&quot;c1&quot;&gt;# run/call whatever logic should turn sanitize_email on and off in this Proc.&lt;/span&gt;
  &lt;span class=&quot;c1&quot;&gt;# config[:activation_proc] =      Proc.new { true }&lt;/span&gt;
  &lt;span class=&quot;c1&quot;&gt;# Since this configuration is *inside* the spec_helper, it might be assumed that we always want to sanitize.  If we don&apos;t want to it can be easily manipulated with SanitizeEmail.unsanitary and SanitizeEmail.sanitary block helpers.&lt;/span&gt;
  &lt;span class=&quot;c1&quot;&gt;# Thus instead of using the Proc (slower) we just engage it always:&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;config&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;ss&quot;&gt;:engage&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;kp&quot;&gt;true&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;config&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;ss&quot;&gt;:use_actual_email_prepended_to_subject&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;kp&quot;&gt;true&lt;/span&gt;         &lt;span class=&quot;c1&quot;&gt;# or false&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;config&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;ss&quot;&gt;:use_actual_environment_prepended_to_subject&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;kp&quot;&gt;true&lt;/span&gt;   &lt;span class=&quot;c1&quot;&gt;# or false&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;config&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;ss&quot;&gt;:use_actual_email_as_sanitized_user_name&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;kp&quot;&gt;true&lt;/span&gt;       &lt;span class=&quot;c1&quot;&gt;# or false&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;end&lt;/span&gt;

&lt;span class=&quot;c1&quot;&gt;# If your mail system is not one that sanitize_email automatically configures an interceptor for (ActionMailer, Mail) then you will need to do the equivalent for whatever Mail system you are using:&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;# Mail.register_interceptor(SanitizeEmail::Bleach.new)&lt;/span&gt;

&lt;span class=&quot;c1&quot;&gt;# You need to know what to do here... somehow get the methods into rhw scope of your tests.&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;# Something like this maybe?&lt;/span&gt;
&lt;span class=&quot;kp&quot;&gt;include&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;SanitizeEmail&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;TestHelpers&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;# Look here to see what it gives you:&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;# https://github.com/pboling/sanitize_email/blob/master/lib/sanitize_email/test_helpers.rb&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;deprecations&quot;&gt;Deprecations&lt;/h2&gt;

&lt;p&gt;Sometimes things get deprecated (meaning they still work, but are noisy about it).  If this happens to you, and you like your head in the sand, call this number:&lt;/p&gt;

&lt;div class=&quot;language-ruby highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;no&quot;&gt;SanitizeEmail&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;Deprecation&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;deprecate_in_silence&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;kp&quot;&gt;true&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;authors&quot;&gt;Authors&lt;/h2&gt;

&lt;p&gt;Peter Boling is the original author of the code, and current maintainer of both the rails 2 and rails 3 development tracks.
John Trupiano did the initial gemification and some refactoring.&lt;/p&gt;

&lt;h2 id=&quot;contributors&quot;&gt;Contributors&lt;/h2&gt;

&lt;p&gt;See the &lt;a href=&quot;https://github.com/pboling/sanitize_email/network&quot;&gt;Network View&lt;/a&gt; and the &lt;a href=&quot;https://github.com/pboling/sanitize_email/blob/master/CHANGELOG.md&quot;&gt;CHANGELOG&lt;/a&gt;&lt;/p&gt;

&lt;h2 id=&quot;how-you-can-help&quot;&gt;How you can help!&lt;/h2&gt;

&lt;p&gt;Take a look at the &lt;code class=&quot;highlighter-rouge&quot;&gt;reek&lt;/code&gt; list which is the file called &lt;code class=&quot;highlighter-rouge&quot;&gt;REEK&lt;/code&gt; and stat fixing things.  Once you complete a change, run the tests:&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;highlighter-rouge&quot;&gt;bundle exec rake test:all&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;If the tests pass refresh the &lt;code class=&quot;highlighter-rouge&quot;&gt;reek&lt;/code&gt; list:&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;highlighter-rouge&quot;&gt;bundle exec reek &amp;gt; REEK&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Follow the instructions for “Contributing” below.&lt;/p&gt;

&lt;h2 id=&quot;contributing&quot;&gt;Contributing&lt;/h2&gt;

&lt;ol&gt;
  &lt;li&gt;Fork it&lt;/li&gt;
  &lt;li&gt;Create your feature branch (&lt;code class=&quot;highlighter-rouge&quot;&gt;git checkout -b my-new-feature&lt;/code&gt;)&lt;/li&gt;
  &lt;li&gt;Commit your changes (&lt;code class=&quot;highlighter-rouge&quot;&gt;git commit -am &apos;Added some feature&apos;&lt;/code&gt;)&lt;/li&gt;
  &lt;li&gt;Push to the branch (&lt;code class=&quot;highlighter-rouge&quot;&gt;git push origin my-new-feature&lt;/code&gt;)&lt;/li&gt;
  &lt;li&gt;Make sure to add tests for it. This is important so I don’t break it in a future version unintentionally.&lt;/li&gt;
  &lt;li&gt;Create new Pull Request&lt;/li&gt;
&lt;/ol&gt;

&lt;h2 id=&quot;versioning&quot;&gt;Versioning&lt;/h2&gt;

&lt;p&gt;This library aims to adhere to &lt;a href=&quot;http://semver.org/&quot;&gt;Semantic Versioning 2.0.0&lt;/a&gt;.
Violations of this scheme should be reported as bugs. Specifically,
if a minor or patch version is released that breaks backward
compatibility, a new version should be immediately released that
restores compatibility. Breaking changes to the public API will
only be introduced with new major versions.&lt;/p&gt;

&lt;p&gt;As a result of this policy, you can (and should) specify a
dependency on this gem using the &lt;a href=&quot;http://docs.rubygems.org/read/chapter/16#page74&quot;&gt;Pessimistic Version Constraint&lt;/a&gt; with two digits of precision.&lt;/p&gt;

&lt;p&gt;For example:&lt;/p&gt;

&lt;div class=&quot;language-ruby highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;n&quot;&gt;spec&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;add_dependency&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&apos;sanitize_email&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&apos;~&amp;gt; 1.1&apos;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;references&quot;&gt;References&lt;/h2&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;http://github.com/pboling/sanitize_email&quot;&gt;Source Code&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://blog.smartlogicsolutions.com/2009/04/25/reintroducing-sanitize_email-work-with-production-email-without-fear/&quot;&gt;Gem Release Announcement&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://galtzo.blogspot.com/2008/11/sanitize-email-never-worry-about.html&quot;&gt;Peter’s Original Writeup&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://blog.smartlogicsolutions.com/2009/04/30/using-sanitize-email-to-preview-html-emails-locally/&quot;&gt;Using sanitize_email to Preview HTML Emails Locally&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;legal&quot;&gt;Legal&lt;/h2&gt;

&lt;ul&gt;
  &lt;li&gt;MIT License - See LICENSE file in this project&lt;/li&gt;
  &lt;li&gt;Copyright (c) 2008-2015 &lt;a href=&quot;http://www.peterboling.com&quot;&gt;Peter H. Boling&lt;/a&gt; of &lt;a href=&quot;http://www.railsbling.com&quot;&gt;Rails Bling&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;Copyright (c) 2009 &lt;a href=&quot;http://smartlogicsolutions.com/wiki/John_Trupiano&quot;&gt;John Trupiano&lt;/a&gt; of &lt;a href=&quot;http://www.smartlogicsolutions.com&quot;&gt;SmartLogic Solutions, LLC&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;</content><category term="development" /><category term="ruby" /><category term="rails" /><category term="rubygems" /><category term="rspec" /><category term="sanitize_email" /><category term="email" /></entry></feed>