Created
November 12, 2011 17:58
-
-
Save jpmckinney/1360883 to your computer and use it in GitHub Desktop.
How to safely create friendly From addresses including name and email
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# blog post: http://blog.slashpoundbang.com/post/12695434343/how-to-safely-create-friendly-from-addresses-including | |
require 'mail' | |
# You already have +name+ and +email+ from the contact form. | |
address = Mail::Address.new email # john@example.com | |
address.display_name = name # John Doe | |
# Set the From or Reply-To header to the following: | |
address.format # John Doe <john@example.com> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment