Page 1 of 1

Chore status update (successful and unsuccessfull) to Email

Posted: Tue Jan 01, 2013 1:45 am
by l_kothamasu
Hi All,

Can anyone please suggest how to send an Email in TM1, Like a process has finished, user wants to know what are all the process has been finished. Give me examples how to Email in TM1 or any document regarding this.

Many people suggested to use the Third party software (I mean install the third party tool into TM1 server and execute), but I am not able to receive any email after following the instructions. Whenever I am trying to execute in command prompt, below error message pops up:

"TM1 server name sendemail.exe[150020]:ERROR => Received:
500 syntax error, command "XXXX TM1servername" unrecogni
zed
TM1 servername sendemail.exe [150020]:NOTICE => EHLO command fa
iled, attempting HELO instead
TM1 servername sendemail.exe [150020]: ERROR => Received:
554 Mail from (from email ID) rejected for policy reasons."

Any suggestions and solutions with steps is greatly appreciated.

Thanks

Re: Chore status update (successful and unsuccessfull) to Em

Posted: Tue Jan 01, 2013 11:14 pm
by RJ!
I've been trying to get this to work as a VB Script called by TM1 but am waiting on our Desktop Support guys to give me the Exchange Server settings etc:

Code: Select all

'#-------------------------------------------------------------------------
    '#  FUNCTION.......:  sendMail(strFrom, strTo, strSubject, strMail)
    '#  ARGUMENTS......:  strFrom - Email Sender
    '#                    strTo - Email recipient
    '#                    strSubject - Email subject
    '#                    strMail - Email body
    '#  PURPOSE........:  Sends email from a script
    '#  EXAMPLE........:  sendMail "scriptTest@gmail.com", _
    '#                    "recipient@emailAddress.com", _
    '#                    "sendMail Function Test", _
    '#                    "This is a test of the sendMail Function."
    '#          
    '#  NOTES..........:  For this to work, you must define the variable 
    '#                    "oMailServer" on line 1 of the actual Function. This
    '#                    must be set to a valid email server that will accept
    '#                    unauthenticated email from your machine (if you host
    '#                    Exchange onsite, it will do this by default).
    '#
    '#                    To add an attachment add this code above the Function
    '#                    call:
    '#                    strAttachment = "c:\yourAttachment.txt"
    '#                    strMailFile = 1
    '#
    '#                    If there are two attachemnts, add this code before
    '#                    the Function call:
    '#                    strAttachment = "c:\yourAttachment.txt"
    '#                    strAttachment2 = "c:\yourAttachment2.txt"
    '#                    strMailFile = 2
    '# 
    '#-------------------------------------------------------------------------
    Function sendMail(strFrom, strTo, strSubject, strMail)
        oMailServer = "your.mail.server.com"
        Set objEmail = CreateObject("CDO.Message")
            objEmail.From = strFrom
            objEmail.To = strTo
            objEmail.Subject = strSubject 
            objEmail.Textbody = strMail
            If strMailFile = 1 Then
                objEmail.AddAttachment strAttachment
            End If
            If strMailFile = 2 Then
                objEmail.AddAttachment strAttachment
                objEmail.AddAttachment strAttachment2
            End If
        objEmail.Configuration.Fields.Item _
    	    ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
        objEmail.Configuration.Fields.Item _
    	    ("http://schemas.microsoft.com/cdo/configuration/smtpserver") = _
    	        oMailServer 
        objEmail.Configuration.Fields.Item _
    	    ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") _
                = 25
        objEmail.Configuration.Fields.Update
        objEmail.Send
    End Function

Re: Chore status update (successful and unsuccessfull) to Em

Posted: Thu Jan 03, 2013 3:33 am
by Andy Key
You'll find plenty of solutions if you search the forum for EMail.

Re: Chore status update (successful and unsuccessfull) to Em

Posted: Mon Jan 07, 2013 9:02 am
by l_kothamasu
Hi,

Thanks to Andy and RJ for your reply.

At last, I have completed this task half way, which means I have prepared TWO batch files (one for “Successful” and another for “Unsuccessful”). But, when I wrote the TI Process to execute these batches then they are not working, Please find the below explanation in detail:

- When I execute batch files manually (which means just double click the batch files) then I am receiving emails (One for successful and another for Unsuccessful) to my account.

- When I had written the below coding in Prolog tab (4 different ways) then I am not receiving any email to my account. Here I am planning to write the coding as If condition to satisfy only one batch files (successful or unsuccessful). Please see below coding:

Way 1:
------------------------------------
§ No Data source

§ No Variable declaration

§ In Prolog Tab

vResult = 0;

Set = EXECUTEPROCESS('ProcessName');

IF (Set = ProcessExitNormal());

vResult = 1;

ENDIF;

IF(vResult = 1);

# If it successful

vCommandLine = 'Path of successful.bat';

ELSE;

# If it Failed

vCommandLine = 'Path of Unscuccessful.bat';

ENDIF;

ExecuteCommand(vCommandLine, 0);

Way 2:
----------------------------------
§ No Data source

§ No Variable declaration

§ In Prolog Tab

return_Value = ExecuteProcess('processname');

IF(return_Value = ProcessExitSeriousError() );

#If it failed

vCommandLine = 'path of Failed.bat';

ELSE;

#It it success

vCommandLine = 'path of Successful.bat';

ENDIF;

ExecuteCommand(vCommandLine, 0);

Way 3:
---------------------------------
§ No Data source

§ No Variable declaration

§ In Prolog Tab

vResult = 0;

Set = EXECUTEPROCESS('processname);
IF (Set = ProcessExitNormal());
vResult = 1;
ENDIF;

IF(vResult <> 0);
# It if success
vSuccess = 'path of successful.bat';
ExecuteCommand(vSuccess,0);
ELSE;
# If it failed
vFailure = 'path of failure.bat';
ExecuteCommand(vFailure,0);
ENDIF;

Way 4:
----------------------------------
§ No Data source

§ No Variable declaration

§ In Prolog Tab

vResult=0;

pcube = Dummy_Process';

set1 = EXECUTEPROCESS('process name');
CELLPUTS(TIMST(NOW, '\Y-\M-\d \h:\i:\s'), pcube,'Subset Update', 'Time');
IF(set1=ProcessExitNormal());
CELLPUTN(1,pcube,'Subset Update','Count');
ENDIF;

set2 = EXECUTEPROCESS('saveDataAll');
CELLPUTS(TIMST(NOW, '\Y-\M-\d \h:\i:\s'), pcube, 'SaveDataAll', 'Time');
IF(set2=ProcessExitNormal());
CELLPUTN(1,pcube,'saveDataAll','Count');
ENDIF;

IF(CELLGETN('Dummy_Process','All','Count')=2);
vResult=1;
ENDIF;

IF(vResult =1);
# If it Successful
vCommandLine = 'path of successful.bat';
ELSE;
# If it Failed
vCommandLine = 'path of failed.bat';
ENDIF;

ExecuteCommand(vCommandLine,0);

----
Any suggestions are greatly appreciated...

Re: Chore status update (successful and unsuccessfull) to Em

Posted: Wed Jan 09, 2013 2:26 am
by PlanningDev
There are a couple of freeware 3rd party SMTP emailers as well. Blat.exe is one of them that works well and can send html and attachments through SMTP as well.

You don't really need a .bat file if you use a compiled program as well. I would say its better to design a Master TI Process called SendEmail or something like that and simply setup all the parameters there and code there. Then any time you need to send an email you simply call your TI called SendEmail.