Send email with Ruby without SMTP server installed/running?

Howard picture Howard · Jul 23, 2013 · Viewed 7.3k times · Source

On Mac, I can send email from command line using the command mail, but definitely I don't have SMTP server installed on my MacBookPro.

So, it is possible to send email with Ruby without an SMTP server? I don't care about the speed, I just want a way to send email without additional software needed.

Answer

severin picture severin · Jul 28, 2013

You could just call the mail command from within your Ruby code. Use system or backticks or something more sophisticated like open3 to interact with system commands... Here is a nice overview over the different methods: http://mentalized.net/journal/2010/03/08/5_ways_to_run_commands_from_ruby/