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.
해결책
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.
다른 팁
If you find yourself having the same problem as me, it's very easy to fix. Info here
Basically you just have to run these three lines in the terminal
sudo mkdir -p /Library/Server/Mail/Data/spool
sudo /usr/sbin/postfix set-permissions
sudo /usr/sbin/postfix start
This answer was given to me at https://apple.stackexchange.com/questions/54051/sendmail-error-on-os-x-mountain-lion