Mail sent without any attachment

Post Reply
ViRa
Regular Participant
Posts: 155
Joined: Tue May 14, 2013 1:53 pm
OLAP Product: Cognos BI, TM1
Version: 9.5.2 - 10.1.1
Excel Version: Excel 2003

Mail sent without any attachment

Post by ViRa »

Hi all,

I'm trying to send email notification using TI process. With the help of this forum, I'm able to do so. However, the required file is not getting attached. I need your assistance in helping me resolve this issue. Thanks a lot for your time and efforts.

Prolog : I have the code to fetch for latest log file -

Code: Select all

Lastfile = '';
s_TimeStamp = TimSt (Now, '\Y\m\d');

logfile = WildcardFileSearch( 'E:\Program Files\Cognos TM1\DataServers\TM1Data\ForDemo_Log\TM1ProcessError_'|s_TimeStamp|'*.log', lastfile);

WHILE ( logfile @<> '' );
Lastfile = logfile;
logfile = WildcardFileSearch( 'E:\Program Files\Cognos TM1\DataServers\TM1Data\ForDemo_Log\TM1ProcessError_'|s_TimeStamp|'*.log', lastfile);
END;

pAttachFile = logfile;
Epilog: I have the required vb script in place that send across email -

Code: Select all

IF( pAttachFile @<> ' ' );
arguments = 'CScript "E:\Program Files\Cognos TM1\DataServers\TM1Data\ForDemo\sendMailOther.vbs"  '|sSMTPSvr |' ' | sSender | ' "'|pRecipient|'" "'|pSubject|'" "'
| sFileName | '" "' | pAttachFile | '"';
ELSE;
arguments = 'CScript "E:\Program Files\Cognos TM1\DataServers\TM1Data\ForDemo\sendMailOther.vbs" '|sSMTPSvr |' ' | sSender | ' "'|pRecipient|'" "'|pSubject|'" "'
| sFileName | '" "' | pAttachFile | '"';
ENDIF;


EXECUTECOMMAND(arguments ,1);
When I run this process, email is sent but the file is not getting attached. However, if I hardcode the required file (with its location) it goes through.

Please advice as I have tried tweaking the code several times.

Thanks again and happy holidays!
ViRa
Regular Participant
Posts: 155
Joined: Tue May 14, 2013 1:53 pm
OLAP Product: Cognos BI, TM1
Version: 9.5.2 - 10.1.1
Excel Version: Excel 2003

Re: Mail sent without any attachment

Post by ViRa »

Hi all,

Can somebody please assist me with the query?

Thanks
digger
Posts: 9
Joined: Fri Feb 18, 2011 6:04 pm
OLAP Product: TM1 and Cognos BI
Version: 10.1.1
Excel Version: 2003-2007-2010

Re: Mail sent without any attachment

Post by digger »

I think that your issue would be in the VBS file.
tomok
MVP
Posts: 2836
Joined: Tue Feb 16, 2010 2:39 pm
OLAP Product: TM1, Palo
Version: Beginning of time thru 10.2
Excel Version: 2003-2007-2010-2013
Location: Atlanta, GA
Contact:

Re: Mail sent without any attachment

Post by tomok »

I suggest you modify your code to do an ASCIIOutput of the variable "arguments" and make sure the string you are creating is actually going to do what you intend it to. 99% chance it isn't correc now and once you actually see what you've got in that variable it will jump and bite you as to what you're doing wrong.
Tom O'Kelley - Manager Finance Systems
American Tower
http://www.onlinecourtreservations.com/
ViRa
Regular Participant
Posts: 155
Joined: Tue May 14, 2013 1:53 pm
OLAP Product: Cognos BI, TM1
Version: 9.5.2 - 10.1.1
Excel Version: Excel 2003

Re: Mail sent without any attachment

Post by ViRa »

Thanks Digger for your reply.

Thanks Tom. I did an ASCIIOUTPUT and found that pAttachFile was blank. I modified Prolog now as below and did ASCIIOUTPUT. The pAttachFile variable now shows the log file I require however this time the email is not getting triggered. Could you please guide me?

Code: Select all

#Capture the last file in the directory
Lastfile =  'TM1ProcessError_20141229163828_Load EDI Cube.log'; 

logfile = WildcardFileSearch( 'E:\Program Files\Cognos TM1\DataServers\TM1Data\ForDemo_Log\TM1ProcessError_'|s_TimeStamp|'*.log', Lastfile);

pAttachFile = logfile;
ASCII/O
ASCII/O
ASCIIFile.JPG (25.34 KiB) Viewed 5612 times
tomok
MVP
Posts: 2836
Joined: Tue Feb 16, 2010 2:39 pm
OLAP Product: TM1, Palo
Version: Beginning of time thru 10.2
Excel Version: 2003-2007-2010-2013
Location: Atlanta, GA
Contact:

Re: Mail sent without any attachment

Post by tomok »

I see the name of the file you are trying to attach but I don't see the path. How is the email program going to be able to attach a file to an email if it doesn't know where to find it? When you store files on a computer the name of the file is only half the equation. You always need the path to where it is stored. Have you tried executing the email program without executing it through a TI, using the string produced in the "arguments" variable, to see if it works. That's the whole purpose of doing an ASCIIOutput so you can execute without doing a TI. If it won't work running manually how's it going to work in a TI?
Tom O'Kelley - Manager Finance Systems
American Tower
http://www.onlinecourtreservations.com/
ViRa
Regular Participant
Posts: 155
Joined: Tue May 14, 2013 1:53 pm
OLAP Product: Cognos BI, TM1
Version: 9.5.2 - 10.1.1
Excel Version: Excel 2003

Re: Mail sent without any attachment

Post by ViRa »

Thanks Tom, I modified the code to provide the path for the log files and the email triggered successfully with all the required log files as attachments.

Thanks for your time and help.
Post Reply