BLOG     |     FORUM
Welcome, Guest
Username: Password: Remember me
Get quick Unbrowse SNMP help from Unleash Networks Engineers. The fastest way.

TOPIC: New article : Sending emails on SNMP Traps

Re:New article : Sending emails on SNMP Traps 14 years 1 month ago #281

Listening for traps ..
"Unable to send mail 530 5.7.0 Must issue a STARTTLS command first. 5sm45912ywd.
29n"

You mail server is setup to use TLS security.
Can you change these lines in t2mail.rb ?
Net::SMTP.start(svropts[:server],svropts[:port],svropts[:domain],				    svropts[:username],svropts[:password],:login) do |smtp|
	smtp.send_mail m_msg, mail.from_addrs, mail.destinations
			end

to

Net::SMTP.start(svropts[:server],svropts[:port],svropts[:domain],
						  svropts[:username],svropts[:password],:login) do |smtp|
smtp.enable_starttls_auto 
	 smtp.send_mail m_msg, mail.from_addrs, mail.destinations
			end


Just add the smtp.enable_starttls_auto line.

Let me know if that works.
Vivek R
Unleash Networks
Support : www.unleashnetworks.com/forums
The administrator has disabled public write access.

Re:New article : Sending emails on SNMP Traps 14 years 1 month ago #282

This is what i get when i put the line you asked me to higher in the script.


C:\Documents and Settings\Administrator\Desktop>ruby t2mail.rb
Loaded the Unbrowse SNMP Trap Server
Starting ..
Listening for traps ..
"Unable to send mail undefined local variable or method `smtp' for main:Object"
"Sent email at 2010-02-17 14:02:42 -0700"
stopping the trap receiver
t2mail.rb:158:in `method_missing': unknown property or method: `Stop' (WIN32OLERuntimeError)
HRESULT error code:0x800706ba
The RPC server is unavailable.
from t2mail.rb:158:in `<main>'

C:\Documents and Settings\Administrator\Desktop>
Last Edit: 14 years 1 month ago by denvaa.
The administrator has disabled public write access.

Re:New article : Sending emails on SNMP Traps 14 years 1 month ago #283

I made the changes in the script but it is still complaining about TLS.


C:\Documents and Settings\Administrator\Desktop>ruby t2mail.rb
Loaded the Unbrowse SNMP Trap Server
Starting ..
Listening for traps ..
"Unable to send mail 530 5.7.0 Must issue a STARTTLS command first. 6sm3349924yxg.48\n"
"Sent email at 2010-02-17 13:39:05 -0700"
stopping the trap receiver
t2mail.rb:158:in `method_missing': unknown property or method: `Stop' (WIN32OLERuntimeError)
HRESULT error code:0x800706ba
The RPC server is unavailable.
from t2mail.rb:158:in `<main>'

C:\Documents and Settings\Administrator\Desktop>






Also attached my script
The administrator has disabled public write access.

Re:New article : Sending emails on SNMP Traps 14 years 1 month ago #284

#connect to the SMTP server and send mail
begin
Net::SMTP.start(svropts[:server],svropts[:port],svropts[:domain],
svropts[:username],svropts[:password],:login) do |smtp|
smtp.enable_starttls_auto
smtp.send_mail m_msg, mail.from_addrs, mail.destinations
end
rescue Exception => e
p "Unable to send mail " + e.message
end

p "Sent email at " + Time.now.to_s
end
The administrator has disabled public write access.

Re:New article : Sending emails on SNMP Traps 14 years 1 month ago #285

Sorry my earlier advice only works with Ruby 1.8.7 and above.

The following worked for me (sent traps via gmail account)

1. Install tlsmail

gem install tmail


2. Add this line at the top (the third line is new)
require 'win32ole'
require 'net/smtp'
require 'tlsmail'
3. Make this change

#connect to the SMTP server and send mail
begin
Net::SMTP.enable_tls(OpenSSL::SSL::VERIFY_NONE)
Net::SMTP.start(svropts[:server],svropts[:port],svropts[:domain],
svropts[:username], svropts[:password],:login) do

You should be able to connect and send via STARTTLS.

Let me know is this works and I will send you another script that allows you to route based on severity.

Thanks,
Vivek R
Unleash Networks
Support : www.unleashnetworks.com/forums
The administrator has disabled public write access.

Re:New article : Sending emails on SNMP Traps 14 years 1 month ago #286

I had to do a gem install tlsmail as well but still getting errors after putting in your recommendations. I have attached my actual script maybe you could edit it and send it back?


Thanks so much for your help!!!!!

C:\Documents and Settings\Administrator\Desktop>gem install tlsmail
Successfully installed tlsmail-0.0.1
1 gem installed
Installing ri documentation for tlsmail-0.0.1...
Installing RDoc documentation for tlsmail-0.0.1...

C:\Documents and Settings\Administrator\Desktop>ruby t2mail.rb
C:/Ruby19/lib/ruby/gems/1.9.1/gems/tlsmail-0.0.1/lib/net/smtp.rb:806: warning: already initialized constant SMTPSession
C:/Ruby19/lib/ruby/gems/1.9.1/gems/tlsmail-0.0.1/lib/net/pop.rb:687: warning: already initialized constant POP
C:/Ruby19/lib/ruby/gems/1.9.1/gems/tlsmail-0.0.1/lib/net/pop.rb:688: warning: already initialized constant POPSession
C:/Ruby19/lib/ruby/gems/1.9.1/gems/tlsmail-0.0.1/lib/net/pop.rb:689: warning: already initialized constant POP3Session
C:/Ruby19/lib/ruby/gems/1.9.1/gems/tlsmail-0.0.1/lib/net/pop.rb:702: warning: already initialized constant APOPSession
Loaded the Unbrowse SNMP Trap Server
Starting ..
Listening for traps ..
"Unable to send mail 555 5.5.2 Syntax error. 13sm1859915gxk.0\n"
"Sent email at 2010-02-18 09:12:44 -0700"
stopping the trap receiver
t2mail.rb:160:in `method_missing': unknown property or method: `Stop' (WIN32OLERuntimeError)
HRESULT error code:0x800706ba
The RPC server is unavailable.
from t2mail.rb:160:in `<main>'

C:\Documents and Settings\Administrator\Desktop>

Attachment t2mail.txt not found

Attachments:
The administrator has disabled public write access.
Moderators: vivek [unleash]
Time to create page: 0.038 seconds