From: "John N. Alegre" Date: 2006-03-11T06:23:44+09:00 Subject: [SOLVED] Re: Can't get net/smtp to send outside of LAN? For anyone who has been following this thread I have solved the problem. Well I guess a better term is there never was a problem. Two months ago I changed IPs and got a new block of static IPs. The entry for reverse DNS lookup on the mail software they use was set to require reverse DNS for email. Things like evolution or the Macintosh OS X mailers do reverse DNS so those things worked fine. The raw code however did not handle revers DNS so the mail send failed. Once they changed the entry the code shown below will send mail out just fine. Hope this helps someone else. Peace john John N. Alegre wrote: > I am trying to use net/smtp to send a mail message. What I am finding is > that I can send a email message on the LAN but it never gets out to the > world. What am I missing? > > Here is my test code: > #################################################################### > require('net/smtp') > > class Email > def Email.send(date, body, server = 'localhost', port = 25) > Net::SMTP.start(server, port) { |mailer| > text = > "From: info\n" << > "To: usr@domain\n" << > "Date: #{date}\n" << > "Subject: New entry in Database\n" << > "Importance: High\n" << > "MIME-Version: 1.0\n" << > "Sender: #{self.class.name}\n" << > "\n\n\n" << > body > > mailer.send_message(text, "info", "usr@domain") > } > end > > end > > Email.send("#{Time.now}", "New entry in database at #{ Time.now}\n") > puts "end of code" > #################################################################### > on the LAN SMTP server with 'localhost' and usr@domain being a user on the > same machine WORKS OK ... with 'localhost' replaced with 'machine' where > machine is the machine on the LAN that sends SMTP mail and usr@domain is a > user on that same machine and the code is run anywhere on the LAN it WORKS > OK to a user on 'machine' ... > > HOWEVER ... > > if usr@domain is outside the LAN the mail never gets sent either if the > code is run on 'localhost' or on a machine on the LAN with 'machine' > replaced by > the IP of the SMTP server. I know 'machine' will serve as a SMTP host for > mailers such as evolution or Mac OX X mailer because I use it for that all > the time. > > What am I missing. > > I know I could go to a better Ruby package such as TMail or RubyMail or > bring out the cannons and use ActionMailer but if I don't understand what > is happening at this basic level that might not help either. > > All comments welcome > john