From: Hd Pwnz0r Date: 2010-08-18T02:03:11+09:00 Subject: Re: SMTP SMS Reminder Script Brian Candler wrote: > Hd Pwnz0r wrote: >> Brian Candler wrote: >>> Hd Pwnz0r wrote: >>>> username = gets >>> ... >>>> password=gets >>> ... >>> >>> Probably it's the newline on the end of the username and password. Try >>> >>> username = gets.chomp >>> password = gets.chomp >> >> I've tried that previously, the script just sits there until I interrupt >> it. > > Sure. So you have another bug. To be sure, try typing a wrong password > and see if it's rejected. > > Try adding some STDERR.puts "..." lines to see how far you're getting. > > I note some strange things in your script: > > Net::SMTP.start('smtp.gmail.com', 587, 'gmail.com', > username, password, :plain) do |smtp| > smtp.send_message message > '@gmail.com' #<< this line does nothing > '@txt.att.net' #<< this line does nothing > end > > and: > > while Times_Sent < x > Times_Sent = Times_Sent + 1 # This just loops until Times_sent == x > end > > I suggest you start with the simplest possible script - which sends one > E-mail - before making it more complex. Google for "ruby Net::SMTP > gmail" to find some working examples. stderr: /usr/lib/ruby/1.8/net/smtp.rb:551:in `initialize': getaddrinfo: Servname not supported for ai_socktype (SocketError) 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 prog.rb:15 There's the stderr, and I'll check into that thanks. It still gets the output but there's a socketerror. -- Posted via http://www.ruby-forum.com/.