Sending mail with Ruby and ActionMailer

rob 08 May 2010
?

This is a simple, but useful little script I ended up writing to test some things. I found it easier to use this than to constantly use the mail command. It basically wraps action mailer in a small ruby script so you can call it from the command line.

./spoofmail.rb --to=who@where.com --from=sjobs@apple.com --subject='Hey You!' --body='whatsup guy?'

or using STDIN

./spoofmail.rb --to=who@where.com --from=sjobs@apple.com --subject='Hey You!' < body_of_message

cat|./spoofmail.rb --to=who@where.com --from=sjobs@apple.com --subject='Hey You!'
whatsup guy?
^d

It might come in handy one day when you need to mess with a co-worker or test a mail receiver… or something else?