From: Eric Hodel Date: 2011-11-03T07:05:34+09:00 Subject: Re: Ruby and Telnet On Nov 2, 2011, at 3:12 AM, Leo M. wrote: > I got another issue though. > > It seems that it doesn't recognize from the second command onward. > > So basically I'm able to perform just the first "helo *my email > address*", but I'm don't receive any answer for an eventual "mail > from:<*email*>" or "rcpt to:<*email*>". > > Any idea? This script uses Net::SMTP and can send mail to gmail.com accounts require 'net/smtp' require 'time' smtp = Net::SMTP.new 'gmail-smtp-in.l.google.com', 'smtp' smtp.debug_output = $stderr smtp.start 'example' do smtp.mailfrom 'you@example' smtp.rcptto 'some_address@gmail.com' smtp.data do |body| body.puts "Subject: test from net/smtp" body.puts "From: " body.puts "Date: #{Time.now.rfc2822}" body.puts body.puts "This is how net/smtp works:" body.puts IO.readlines(__FILE__).each do |line| body.puts " #{line}" end end end