R
ruby talk
Code:
require 'net/smtp'
Net::SMTP.start('smtp.gmail.com', 25,'[email protected]' ,
'password' , :login ) do |smtp|
smtp.open_message_stream('[email protected]',
['[email protected]']) do |f|
f.puts 'From:[email protected]'
f.puts 'To:[email protected]'
f.puts 'Subject: test message'
f.puts
f.puts 'This is a test message.'
end
end
The error i get is
/usr/local/lib/ruby/1.8/net/smtp.rb:680:in `check_response': 530 5.7.0
Must issue a STARTTLS command first (Net::SMTPUnknownError)
from /usr/local/lib/ruby/1.8/net/smtp.rb:593:in `auth_cram_md5'
from /usr/local/lib/ruby/1.8/net/smtp.rb:592:in `critical'
from /usr/local/lib/ruby/1.8/net/smtp.rb:592:in `auth_cram_md5'
from /usr/local/lib/ruby/1.8/net/smtp.rb:571:in `__send__'
from /usr/local/lib/ruby/1.8/net/smtp.rb:571:in `authenticate'
from /usr/local/lib/ruby/1.8/net/smtp.rb:411:in `do_start'
from /usr/local/lib/ruby/1.8/net/smtp.rb:378:in `start'
from /usr/local/lib/ruby/1.8/net/smtp.rb:316:in `start'
from email.rb:2
any one find a fix for this or a work around? Am i doing it wrong?
will it work with other smtp servers? I only have gmail to work with.
BEcker