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}>
#{@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.
···
To: #{to_alias} <#{to}>
Subject: #{Error}
--
Posted via http://www.ruby-forum.com/.