# Net::SMTP problems

**URL:** <https://www.ruby-forum.com/t/net-smtp-problems/74575>\
**Category:** Ruby\
**Created:** [November 7, 2006, 10:48am UTC](https://www.ruby-forum.com/t/net-smtp-problems/74575 "2006-11-07T10:48:43Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![nicken](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/d07c76/32.png) [@nicken](https://www.ruby-forum.com/u/nicken)\
**Post date:** [November 7, 2006, 10:48am UTC](https://www.ruby-forum.com/t/net-smtp-problems/74575/1 "2006-11-07T10:48:43Z")

</div>

Hi,

I’m trying to use Net::SMTP to send an email from a webserver running  
Apache2. This bit of code is causing an error:

83 Net::SMTP.start(‘10.0.0.15’, 25) do |smtp|  
84 smtp.send\_message msgstr.untaint,  
85 ‘removed\_email\_address@domain.invalid’.untaint,  
86 email.untaint  
87 end

Which causes a 500 error:

[Tue Oct 31 10:31:46 2006] [error] mod\_ruby: error in ruby  
[Tue Oct 31 10:31:46 2006] [error] mod\_ruby:  
/usr/lib/ruby/1.8/timeout.rb:54:in `new': execution expired (Timeout::Error) [Tue Oct 31 10:31:46 2006] [error] mod_ruby: from /usr/lib/ruby/1.8/net/protocol.rb:206:in`old\_open’  
[Tue Oct 31 10:31:46 2006] [error] mod\_ruby: from  
/usr/lib/ruby/1.8/timeout.rb:56:in `timeout' [Tue Oct 31 10:31:46 2006] [error] mod_ruby: from /usr/lib/ruby/1.8/timeout.rb:76:in`timeout’  
[Tue Oct 31 10:31:46 2006] [error] mod\_ruby: from  
/usr/lib/ruby/1.8/net/protocol.rb:206:in `old_open' [Tue Oct 31 10:31:46 2006] [error] mod_ruby: from /usr/lib/ruby/1.8/net/smtp.rb:393:in`do\_start’  
[Tue Oct 31 10:31:46 2006] [error] mod\_ruby: from  
/usr/lib/ruby/1.8/net/smtp.rb:378:in `start' [Tue Oct 31 10:31:46 2006] [error] mod_ruby: from /usr/lib/ruby/1.8/net/smtp.rb:316:in`start’  
[Tue Oct 31 10:31:46 2006] [error] mod\_ruby: from  
/var/www/mysite/eruby/create.rhtml:83  
[Tue Oct 31 10:31:46 2006] [error] mod\_ruby: from (eval):0  
[Tue Oct 31 10:31:46 2006] [error] mod\_ruby: from  
/usr/lib/ruby/1.8/apache/eruby-run.rb:116:in `run' [Tue Oct 31 10:31:46 2006] [error] mod_ruby: from /usr/lib/ruby/1.8/apache/eruby-run.rb:72:in`handler’

Line 83 of create.rhtml is the first line of the code at the top of the  
email.

The variables email and msgstr contain valid strings (correct email  
addresses)

10.0.0.15 is definitely the address of the mail server, which runs  
smtpd. I can send and receive emails using mail and mutt from  
internal and external programs with no problem. I have port scanned  
using nmap and port 25 is open.

Anyone have any ideas? Any pointers much appreciated,

Nick
