Cisco Support Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Announcements

Welcome to Cisco Support Community. We would love to have your feedback.

For an introduction to the new site, click here. If you'd prefer to explore, try our test area to get started. And see here for current known issues.

New Member

EEM Script for email attachment.

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

Everyone's tags (2)
9 REPLIES
Cisco Employee

Re: EEM Script for email attachment.

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?

New Member

Re: EEM Script for email attachment.

Joe,

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

-D

Cisco Employee

Re: EEM Script for email attachment.

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

Cisco Employee

Re: EEM Script for email attachment.

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

New Member

Re: EEM Script for email attachment.

Joe,

Looks like it didn't get attached !

-D

Cisco Employee

Re: EEM Script for email attachment.

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

New Member

Re: EEM Script for email attachment.

Thank you!

Cisco Employee

Re: EEM Script for email attachment.

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.

Cisco Employee

Re: EEM Script for email attachment.

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

1200
Views
0
Helpful
9
Replies