Search code examples
rubyemailsinatrapony

Pony Mail Gem Throws Broken Pipe Error


So I'm using sinatra, and I'm trying to send emails from the app for basic verification reasons. I was poking around the docs, and I found the gem pony, which seems to be right up my alley. In my app.rb file I have

require 'rubygems'
require 'sinatra'
require 'pony'
require 'mail'

post '/signup' do
  Pony.mail  :to => "myself@me.com", :body => "User Sign Up!", :subject => "score"
end

but I end up with a broken pipe error. See below. I went in to the sendmail.rb, but any change to that and I just got different errors. I think some other people have experienced a similar problem.


Solution

  • Can you send mail with Pony manually via IRB?

    $ irb
    >> require 'rubygems'
    >> require 'pony'
    >> mail = Pony.mail :to => "myself@me.com", :body => "User sign up!", :subject => "score"
    

    You may need to add more options (such as SMTP servers). See https://github.com/benprew/pony for configuration.