cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
8680
Views
0
Helpful
3
Replies

Most Basic EEM Script to Send E-mails

jasocole09
Level 1
Level 1

I have read through various blogs and Cisco posts and still cannot seem to get this to work.  I am simply trying to get the router to send the "show ip int br" info via e-mail from a G-Mail account to a G-Mail account.  I am wondering if this is unsupported because G-mail uses TLS/SSL and different ports and I can't seem to defined this anywhere.  Can anyone confirm?

 

I manually run the EEM script via "event manager run IPAddressNotify".  I have made sure that the router can ping "smtp.gmail.com" (IE IP reachability and name-lookups are successful). 

 

event manager environment _email_to test1@gmail.com
event manager environment _email_server gmailusername:password@smtp.gmail.com
event manager environment _email_from gmailusername@gmail.com

 

event manager applet IPAddressNotify
event none

action 1.0 info type routername
action 1.5 cli command "enable"
action 2.0 cli command "show ip int br"

action 8.0 mail server "$_email_server" to "$_email_to" from "$_email_from" subject "Router reload - IP Address info for $_info_routername" body "$_cli_result"
action 9.0 syslog msg "E-mail was sent"

3 Replies 3

Joe Clarke
Cisco Employee
Cisco Employee

You're between a rock and a hard place here.  You can't use these double '@' in applets and Tcl scripts don't support TLS/SSL.  So, if you can't use clear text SMTP with GMail, then you won't be able to send email with Tcl, and if you have to use an '@' in your username, then you won't be able to send email with an applet.

 

Let's say you don't have an '@' in your username.  Then you can use an applet, but you need EEM 3.0 to send encrypted email, and you need 3.1 as I recall to use a different port.  The additional options are "port" and "secure".  If you don't have them for "action mail" then your device is not running new enough code.

Joseph,

 

Thanks for the info!  This is perfect.  Can you verify that my logic is clear, just so I know I am interpreting this correctly.

 

Right now, my IOS version does NOT support the "secure" and "port" parameters for EEM.  Since G-Mail does NOT support unencrypted SMTP (verified), there is no way that I can use EEM or TCL to e-mail myself messages.  Correct?

When you state that my username cannot have an '@' in it, is this referring to the 'from' field which would be "gmailusername@gmail.com"? Or, is this referring to the 'server' field which would be "gmailusername:password@smtp.gmail.com".  Luckily, Google lets me authenticate by specifying 'gmailusername', rather than 'gmailusername@gmail.com'.  This should work then correct?

You may want to have a look at https://supportforums.cisco.com/discussion/12364956/problem-eem-tcl-smtp-function .  This user found a helpful hint to get GMail working.  Plus, you'll see the Tcl code example you'll need to use the '@' in your username.

Review Cisco Networking for a $25 gift card