03-01-2010 02:06 PM
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
03-01-2010 02:10 PM
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?
03-01-2010 02:31 PM
Joe,
It's a MIME attachment. We are using "c7600rsp72043-advipservicesk9-mz.122-33.SRC4.bin"
-D
03-02-2010 09:15 AM
This should work for you, but I do not have an SRC4 box with which to test.
03-24-2010 09:25 AM
Looks like the forum stripped my attachment. I have attached it again.
03-24-2010 09:34 AM
Joe,
Looks like it didn't get attached !
-D
03-24-2010 10:19 AM
Yeah, something seems broken. This is now the second time it got stripped. Let me try it with a different name.
03-31-2010 10:29 AM
Thank you!
03-31-2010 03:17 PM
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.
03-31-2010 03:26 PM
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
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