Skip to content

Instantly share code, notes, and snippets.

@graysky
Created November 20, 2009 15:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save graysky/239569 to your computer and use it in GitHub Desktop.
Save graysky/239569 to your computer and use it in GitHub Desktop.
# Open an email in Mail.app to preview an HTML email.
#
# Usage: preview_email( MyMailer.create_welcome_msg )
#
def preview_email(tmail)
f = File.open("#{Dir::tmpdir}/email_preview_#{rand(10000)}.eml", 'w')
f.write(tmail.to_s)
f.flush
f.close
`open #{f.path}`
f
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment