[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Problems sending mail

Benito Marcote

2/16/2008 5:21:00 PM

Hi!
I want the program send me a email when a exception happens (sending
it from any computer). But this throws an error:

require 'net/smtp'
...
def sendMeError
to = 'me@mail.com'
from = 'anyone@mail.com'
msg = "To: %s\nFrom: %s\nSubject: %s\n\n%s" % [to,from,
"Error", @message]
Net::SMTP.start('localhost',25) do |smtp|
smtp.send_message msg, from, to
end
end
VentanaPrincipal#sendMeError: Errno::EADDRNOTAVAIL: Can't assign
requested address - connect(2)

And if I chage it for this:
def sendMeError
msg = <<end_of_message from:="" #{from_alias}=""><#{from}>
To: #{to_alias} <#{to}>
Subject: #{Error}
#{@message}
END_OF_MESSAGE
Net::SMTP.start(â??localhostâ??,25) do |smtp|
smtp.send_message msg, from, to
end
end

/Users/benitomarcotemartin/programación/NewtonRaphson/build/Release/NewtonRaphson.app/Contents/Resources/rb_main.rb:17:in
`require':
/Users/benitomarcotemartin/programación/NewtonRaphson/build/Release/NewtonRaphson.app/Contents/Resources/VentanaPrincipal.rb:77:
can't find string "END_OF_MESSAGE" anywhere before EOF (SyntaxError)
/Users/benitomarcotemartin/programación/NewtonRaphson/build/Release/NewtonRaphson.app/Contents/Resources/VentanaPrincipal.rb:64:
syntax error, unexpected $end, expecting tSTRING_CONTENT or tSTRING_DBEG
or tSTRING_DVAR or tSTRING_END from
/Users/benitomarcotemartin/programación/NewtonRaphson/build/Release/NewtonRaphson.app/Contents/Resources/rb_main.rb:17:in
`rb_main_init'


Thanks.
--
Posted via http://www.ruby-....