cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
2062
Views
0
Helpful
9
Replies

EEM Script for email attachment.

dmalla
Level 1
Level 1

I have a scenario where there is a log file named "test.log" on my sup-bootdisk0:. I need to send that log file as an "attachment" to NOC using EEM script. I have a script that can send the plain email as follows.

#----------------------- send e-mail to NOC ----------------------

  set body [format "Mailservername: %s" "$_email_server"]
  set body [format "%s\nFrom: %s" "$body" "$_email_from"]
  set body [format "%s\nTo: %s" "$body" "$_email_to"]
  set body [format "%s\nSubject: %s\n" "$body" "Email from Router $_router_name"]
  set body [format "%s\n%s" "$body" "$show_log"]

  if [catch {smtp_send_email $body} result] {
    action_syslog msg "smtp_send_email: $result"
  }
  action_syslog msg "E-mail sent to $_email_to with attachment."

Can somebody let me know what needs to be added to above script so that it can send the "test.log" file as an email attachment?

Thank you in advance.

D

9 Replies 9

Joe Clarke
Cisco Employee
Cisco Employee

When you say, "attachment," do you mean MIME attachment, or do you just want the contents of the file sent in the body of the email?  What version of code are you running?

Joe,

It's a MIME attachment. We are using "c7600rsp72043-advipservicesk9-mz.122-33.SRC4.bin"

-D

This should work for you, but I do not have an SRC4 box with which to test.

Looks like the forum stripped my attachment.  I have attached it again.

Joe,

Looks like it didn't get attached !

-D

Yeah, something seems broken.  This is now the second time it got stripped.  Let me try it with a different name.

Thank you!

Joe Clarke
Cisco Employee
Cisco Employee

I'll try and post one more time.  I reported this problem to the forum IT staff, but I haven't heard anything back from them.

It didn't work, so I created a document which explains how to do what you want:

https://supportforums.cisco.com/docs/DOC-8935

--

Please support CSC Helps Haiti

https://supportforums.cisco.com/docs/DOC-8895

https://supportforums.cisco.com

Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community: