How in the !@#$% can this function:

def sendMsg(msg, today, cancel)
  
email = <<MSG
Date: #{Time.now}
From: f...@bar.com
Subject: Pediatric Cardiology Apt#{cancel ? ' Cancellation' : ''}
Mime-Version: 1.0
Content-Type: text/html; charset="utf-8";
X-Priority: #{today ? '1' : '3'}

#{msg.encode('US-ASCII', {undef: :replace, invalid: :replace})}
MSG

  Net::SMTP.start("foo-re...@bar.org", 25) do |smtp|
    smtp.send_mail(email, MAILUSER, ["someb...@bar.org"])
  end

end

intermittently produce this error:

/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/net/protocol.rb:325:in
 `slice!': invalid byte sequence in US-ASCII (ArgumentError)
        from 
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/net/protocol.rb:325:in
 `block in each_crlf_line'
        from 
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/net/protocol.rb:336:in
 `block in buffer_filling'
        from 
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/net/protocol.rb:334:in
 `step'
        from 
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/net/protocol.rb:334:in
 `buffer_filling'
        from 
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/net/protocol.rb:324:in
 `each_crlf_line'
        from 
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/net/protocol.rb:269:in
 `write_message_0'
        from 
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/net/protocol.rb:284:in
 `block (2 levels) in write_message'
        from 
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/net/protocol.rb:313:in
 `using_each_crlf_line'
        from 
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/net/protocol.rb:283:in
 `block in write_message'
        from 
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/net/protocol.rb:202:in
 `writing'
        from 
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/net/protocol.rb:282:in
 `write_message'
        from 
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/net/smtp.rb:899:in
 `block in data'
        from 
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/net/smtp.rb:942:in
 `critical'
        from 
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/net/smtp.rb:896:in
 `data'
        from 
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/net/smtp.rb:663:in
 `block in send_message'
        from 
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/net/smtp.rb:852:in
 `rcptto_list'
        from 
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/net/smtp.rb:663:in
 `send_message'
        from /pedcard/scripts/SoarianReport.rb:24:in `block in sendMsg'
...

This is on OS X, and it only happens when run automatically from a launch 
daemon. Logging into the same account and running it manually always works. So 
it's some version or configuration issue. But I find that using rvm on OS X is 
frustrating to say the least...

Any clue as to where this bug comes from? Ruby update needed? Some gem or 
other? What version?

-- 
Scott Ribe
scott_r...@elevated-dev.com
http://www.elevated-dev.com/
(303) 722-0567 voice




-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-talk+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/8F760CC4-4A0E-49F7-9196-4008D31C11E6%40elevated-dev.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to