Hello,

I am trying to test this simple program for sending e-mail using
'net/smtp' but not successful.
Can any one help me to indicate the issue I am facing here .

Note: I do not have any local SMTP server on my machine and I am trying
to connect a remote SMTP server which in this case is a smtp.gmail.com
server.

irb(main):001:0> require 'net/smtp'
=> true
irb(main):002:0>
Net::SMTP.start('smtp.gmail.com',25,'gmail.com','XXXX / gmail.com','XXXXXX',:plain)
do |smtp|
irb(main):003:1* smtp.send_message
'Hello','XXXXXX / gmail.com','XXXXXX / gmail.com'
irb(main):004:1> end
Errno::ETIMEDOUT: Connection timed out - connect(2)
  from /usr/lib/ruby/1.8/net/smtp.rb:551:in `initialize'
  from /usr/lib/ruby/1.8/net/smtp.rb:551:in `open'
  from /usr/lib/ruby/1.8/net/smtp.rb:551:in `do_start'
  from /usr/lib/ruby/1.8/timeout.rb:62:in `timeout'
  from /usr/lib/ruby/1.8/timeout.rb:93:in `timeout'
  from /usr/lib/ruby/1.8/net/smtp.rb:551:in `do_start'
  from /usr/lib/ruby/1.8/net/smtp.rb:525:in `start'
  from /usr/lib/ruby/1.8/net/smtp.rb:463:in `start'
  from (irb):2
  from /usr/lib/ruby/1.8/x86_64-linux/openssl.so:0

----------------------------------
When I tried with different port 587 of smtp.gmail.com then I get the
following error message.

et::SMTPAuthenticationError: 530 5.7.0 Must issue a STARTTLS command
first. w9sm713093wfd.2

  from /usr/lib/ruby/1.8/net/smtp.rb:942:in `check_auth_response'
  from /usr/lib/ruby/1.8/net/smtp.rb:733:in `auth_plain'
  from /usr/lib/ruby/1.8/net/smtp.rb:725:in `send'
  from /usr/lib/ruby/1.8/net/smtp.rb:725:in `authenticate'
  from /usr/lib/ruby/1.8/net/smtp.rb:566:in `do_start'
  from /usr/lib/ruby/1.8/net/smtp.rb:525:in `start'
  from /usr/lib/ruby/1.8/net/smtp.rb:463:in `start'
  from (irb):5
  from /usr/lib/ruby/1.8/x86_64-linux/openssl.so:0

If you have faced this error previously, please share with me your
solution as soon as possible.

Thanks in advance

Regards,
argongold
-- 
Posted via http://www.ruby-forum.com/.