I'm unable to get Mail
(or Pony
for that matter) to connect to send an email via a smtp server with credentials, port number, and address parameter I know are right. However, when using a mail client (thunderbird, ink...etc) I'm able to connect just fine.
Here is the stack trace I'm getting:
ruby gmx_test.rb
/Users/sy/.rvm/rubies/ruby-2.1.0/lib/ruby/2.1.0/net/protocol.rb:153:in `read_nonblock': end of file reached (EOFError)
from /Users/sy/.rvm/rubies/ruby-2.1.0/lib/ruby/2.1.0/net/protocol.rb:153:in `rbuf_fill'
from /Users/sy/.rvm/rubies/ruby-2.1.0/lib/ruby/2.1.0/net/protocol.rb:134:in `readuntil'
from /Users/sy/.rvm/rubies/ruby-2.1.0/lib/ruby/2.1.0/net/protocol.rb:144:in `readline'
from /Users/sy/.rvm/rubies/ruby-2.1.0/lib/ruby/2.1.0/net/smtp.rb:937:in `recv_response'
from /Users/sy/.rvm/rubies/ruby-2.1.0/lib/ruby/2.1.0/net/smtp.rb:554:in `block in do_start'
from /Users/sy/.rvm/rubies/ruby-2.1.0/lib/ruby/2.1.0/net/smtp.rb:947:in `critical'
from /Users/sy/.rvm/rubies/ruby-2.1.0/lib/ruby/2.1.0/net/smtp.rb:554:in `do_start'
from /Users/sy/.rvm/rubies/ruby-2.1.0/lib/ruby/2.1.0/net/smtp.rb:519:in `start'
from /Users/sy/.rvm/gems/ruby-2.1.0/gems/mail-2.5.4/lib/mail/network/delivery_methods/smtp.rb:112:in `deliver!'
from /Users/sy/.rvm/gems/ruby-2.1.0/gems/mail-2.5.4/lib/mail/message.rb:2129:in `do_delivery'
from /Users/sy/.rvm/gems/ruby-2.1.0/gems/mail-2.5.4/lib/mail/message.rb:234:in `deliver'
from /Users/sy/.rvm/gems/ruby-2.1.0/gems/mail-2.5.4/lib/mail/mail.rb:140:in `deliver'
from gmx_test.rb:29:in `<main>'
Here is the code generating:
require 'mail'
gmx_options = { :address => "mail.gmx.com",
:port => 465,
:user_name => '<username_redacted>@gmx.com',
:password => '<password_redacted>',
:authentication => 'plain',
:enable_starttls_auto => true }
Mail.defaults do
delivery_method :smtp, gmx_options
end
Mail.deliver do
to '<redacted>
from '<username_redacted>@gmx.com'
subject 'TEST'
body 'Hi.'
end
Here is a screenshot of the server settings of one of the desktop email client that is able to send emails:
Final plot twist: this code works if I use gmail's smtp.
Thanks for any insight you guys may have!