Yahoo!Mail use POP before SMTP.
A sample code.
require 'net/smtp'
require 'net/pop'
require 'time'
content = <<EOF
From: from@yahoo.co.jp
To: to@yahoo.co.jp
Subject: Hello!
Date: #{Time.now.rfc2822}
How are you.
EOF
Net::POP3.start('pop.mail.yahoo.co.jp', 110, 'Yahoo! ID', 'password') do |pop|
end
Net::SMTP.start('smtp.mail.yahoo.co.jp', 25, 'yahoo.co.jp', 'Yahoo! ID', 'password', :login) do |smtp|
smtp.send_message(content, 'from@yahoo.co.jp', 'to@gmail.com')
end
1 comment:
Thanks a lot.. Its really helpful
Post a Comment