Problems sending mail

B

Benito Marcote

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 = '(e-mail address removed)'
from = '(e-mail address removed)'
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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top