Hi everyone.
I read all topics on this forum which I found regarding my issue. But it doesn't help me to resolve my issue.
So this is why I'm asking for your help.
Using Notification Activity I try to send email with attachment (single file).
The full pathname is:
/iis/InformationServer/Server/Projects/DWH/logs/rejects.txt
(I'm using arrow button and then "Browse for file" to choose the file)
When I run the sequence I receive warning/error:
"The following tokens in the 'dssendmail_template.txt' file have not been set in the call to DSSendMail: %file%"
"Routine DSSendMail did not finish OK, return code = '-18'"
When I run routine DSSendMailAttachmentTester I receive the same warnings:
"
DSLogInfo called from : DSSendMail
Message to be logged is...
> Encoding attachment file '/iis/InformationServer/Server/Projects/DWH/logs/rejects.txt'
DSLogInfo called from : DSSendMail
Message to be logged is...
> Attachment file (approx. 540 bytes) encoded in 0.00 seconds
Program "DSSendMail": Line 757, Variable "MimeBodyHdr" previously undefined. Empty string used.
DSLogWarn called from : DSSendMail
Message to be logged is...
> The following tokens in the 'dssendmail_template.txt' file have not been set in the call to DSSendMail: %file%
Result = Error encountered processing template file
"
My dssendmail_template.txt file looks like this (the end of the file):
"
...
* On UNIX to run sendmail, the template looks like this (doesn't require a <file> section):
* #! /bin/sh
* /usr/lib/sendmail -t <<////
* From: %from%
* To: %to%
* Subject: %subject%
* %body%
* ////
#! /bin/bash
echo "%body%" | mailx -S smtp=%server% -a %file% -r %from% -s "%subject%" -v %to%
"
Could you help?
I add that when I delete "%file%" from command:
"echo "%body%" | mailx -S smtp=%server% -r %from% -s "%subject%" -v %to%"
emails are sent without any errors.
But I need to add attachment to the email.
Regards,
Jack
%file% token was not set in the call to DSSendMail
Moderators: chulett, rschirm, roy
-
- Participant
- Posts: 8
- Joined: Mon Apr 09, 2018 2:47 am
-
- Participant
- Posts: 8
- Joined: Mon Apr 09, 2018 2:47 am
I don't know about the %file% option. Maybe you will get it to work. Here is the way we do it.
When we want to send an attachment from a sequence job, we don't use the notification activity stage. Instead we build a shell script, and we call the script from the sequence job by using a command execution stage.
Here is a shell script template. This comes from an AIX system, so if you are on a different system, you may need to make some extra adjustments if you use this template.
When we want to send an attachment from a sequence job, we don't use the notification activity stage. Instead we build a shell script, and we call the script from the sequence job by using a command execution stage.
Here is a shell script template. This comes from an AIX system, so if you are on a different system, you may need to make some extra adjustments if you use this template.
Code: Select all
#!/bin/ksh
# Script: ....ksh
# Change Log:
# MM/DD/YYYY person - comment
...
# set variables according to arguments
export EMAIL_FROM=$1
export EMAIL_STATUS=$2
export PROJECT_NAME=$3
export EMAIL_SUBJECT=$4
...
export REJECT_FILE_PATH=${12}
...
/usr/lib/sendmail -t <<////
From: $EMAIL_FROM
To: $EMAIL_STATUS
Cc:
Subject: [$PROJECT_NAME] $EMAIL_SUBJECT
...
`uuencode $REJECT_FILE_PATH/$REJECT_FILE output_file.txt `
////
Choose a job you love, and you will never have to work a day in your life. - Confucius
-
- Participant
- Posts: 8
- Joined: Mon Apr 09, 2018 2:47 am
The comments in the dssendmail_template.txt file indicate:
1) the file section is optional (not present in your example):
* 1. File section (optional)
* Declares what lines are to be created in a temporary file to pass to the command.
* Declared by the presence of <file> and </file> lines. If these are present,
* all lines between them are token-expanded, then written out to a temporary
* file in the current directory, whose name is generated from the current
* job name (to avoid clashes).
2) The %file% token is not a reference to an attachment like what you are thinking of; it refers to an optional temporary file that would be generated on the fly:
* %file% replaced by name of temporary file created in the
* <file> section, which must exist (command section only)
3) I think this is the key part here, where it says:
"any attached files passed to DSSendMail will be encoded into the body"
You might try avoiding the %file% token and also reverting back to the original sendmail paragraph that you've got commented out.
The notification stage does appear to support attachments, as there is a field for that where you can pick a file. I tested it here and never received any mail, and the job log looks fine, so I am guessing our mail delivery system swallowed it.
You might need to open a support case to get clarification.
1) the file section is optional (not present in your example):
* 1. File section (optional)
* Declares what lines are to be created in a temporary file to pass to the command.
* Declared by the presence of <file> and </file> lines. If these are present,
* all lines between them are token-expanded, then written out to a temporary
* file in the current directory, whose name is generated from the current
* job name (to avoid clashes).
2) The %file% token is not a reference to an attachment like what you are thinking of; it refers to an optional temporary file that would be generated on the fly:
* %file% replaced by name of temporary file created in the
* <file> section, which must exist (command section only)
3) I think this is the key part here, where it says:
"any attached files passed to DSSendMail will be encoded into the body"
You might try avoiding the %file% token and also reverting back to the original sendmail paragraph that you've got commented out.
The notification stage does appear to support attachments, as there is a field for that where you can pick a file. I tested it here and never received any mail, and the job log looks fine, so I am guessing our mail delivery system swallowed it.
You might need to open a support case to get clarification.
Choose a job you love, and you will never have to work a day in your life. - Confucius
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
-
- Participant
- Posts: 8
- Joined: Mon Apr 09, 2018 2:47 am