10-05-2016 04:38 AM
Hi,
i'm quite new to cisco's EEM TCL; basic cli stuff works fine for me in our ASR9K (version 4.3.4)
However i can't get the smtp to work.
I've created a very simple script for testing e-mail: (used a wan interface to avoid any VRF issues, the mailserver allows port 25 and any ip from our router without aditional credentials).
::cisco::eem::event_register_none
namespace import ::cisco::eem::*
namespace import ::cisco::lib::*
set mail_pre "Mailservername: 193.xxx.xxx.xxx\n"
append mail_pre "From: asr@ourdomain.nl\n"
append mail_pre "To: me@ourdomain.nl\n"
append mail_pre "Cc: \n"
append mail_pre "Subject: Ciscotest\n\n"
append mail_pre "Test succesful\n\n"
set mail_msg [uplevel #0 [list subst -nobackslashes -nocommands $mail_pre]]
if [catch {smtp_send_email $mail_msg} result] {
error $result $errorInfo
}
On execute the ASR9K seems to contact the mailserver (hostname is reported back in the error)
RP/0/RSP0/CPU0:asr9k01#event manager run mailtest.tcl
error connecting to mail server:
can't read "reply_code_str(220-mail.ourdomain.nl)": no such element in array
while executing
"smtp_send_email $mail_msg"
invoked from within
"if [catch {smtp_send_email $mail_msg} result] {
error $result $errorInfo
}"
(file "/dev/rdsfs/etc/eem_rdsfs/mailtest.tcl" line 13)
Anyone that can help me on my smtp-way?
10-06-2016 10:45 AM
Your mail server is returning non-standard reply lines. Typically, the reply code is separated from the additional text with a space. The EEM SMTP code assumes this. Here is an example from my server:
220 host.domain.com ESMTP Sendmail 8.15.2/8.15.2; Thu, 6 Oct 2016 13:44:11 -0400 (EDT)
Is there another SMTP server you can use?
10-06-2016 11:54 PM
Hi Joe,
This is ICEWarp SMTP server.
I'll give it a go on a MS-SMTP service and report back.
grtz
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide