Page 1 of 1
Sending email using TI process
Posted: Mon Jul 20, 2015 7:59 pm
by dilip
I need a sample code or any URL to send email using TI process....Please help me on this learning part.
I have an attachment of file,smtp servername...but dont know the procedure to write ...
Re: Sending email using TI process
Posted: Mon Jul 20, 2015 8:05 pm
by jim wood
Did you try to search here or even google this? There are at least 5-10 threads that cover this is great detail on this site alone.
Re: Sending email using TI process
Posted: Mon Jul 20, 2015 8:09 pm
by dilip
Yes I googled..But not reaching the exact code what i need..I am getting in bits...sometimes i get email notification configuration..which i dont need....sometimes so much lenghty code which is difficult to understand for me. Iam beginner..
Re: Sending email using TI process
Posted: Mon Jul 20, 2015 8:11 pm
by jim wood
There is no email function within TM1. You have build something in from outside. That is why the code may seem a little on the complicated side.
Re: Sending email using TI process
Posted: Mon Jul 20, 2015 8:14 pm
by dilip
Re: Sending email using TI process
Posted: Mon Jul 20, 2015 8:16 pm
by dilip
arguments = 'CScript C:\sendMailOther.vbs '|sSMTPSvr |' ' | sSender | ' "'|pRecipient|'" "'|pSubject|'" "'
| sFileName | '"' ;
ENDIF;
I got this code but here what is "sendMailOther.vbs" which is confusing me...pls help
Re: Sending email using TI process
Posted: Mon Jul 20, 2015 8:22 pm
by declanr
Earlier in the same post is the vb script which needs to be set up.
If you are struggling with that go the easier route and download something like sendmail.exe or BLAT; then all you have to do is pass parameters to the executable.
Re: Sending email using TI process
Posted: Tue Jul 21, 2015 2:27 am
by rmackenzie
declanr wrote:If you are struggling with that go the easier route and download something like sendmail.exe or BLAT; then all you have to do is pass parameters to the executable.
Nowadays, the Powershell option is much easier as it is a default install for a modern Windows OS and has in built e-mail capabaility that is easily accessible from a few lines of TI. With this method there's no need to manage separate executables or scripts and their locations etc. E.g.:
Code: Select all
sFrom = 'tm1@yourcompany';
sTo = 'robin.mackenzie@somewhere.com';
sSubject = 'test';
sBody = 'test';
sSmtpServer = 'name of your smtp server';
# build powershell command
sPsCmd = '"& {
Send-MailMessage
-From ' | sFrom | '
-To ' | sTo | '
-Subject ' | '\"' | sSubject | '\"
-Body ' | '\"' | sBody | '\"
-SmtpServer ' | sSmtpServer | '
}"';
# execute command
ExecuteCommand ( 'powershell.exe -command ' | sPsCmd, 1 );
Re: Sending email using TI process
Posted: Tue Jul 21, 2015 7:04 am
by declanr
Nice and straightforward; I like it.
Re: Sending email using TI process
Posted: Tue Jul 21, 2015 1:24 pm
by dilip
Thanks everyone on this post...I was able to do via TI process...using sendmail.exe....and it worked..
This powershell I have done already..I have done in my last project using powershell,but I was learning to do via TI processs.
Re: Sending email using TI process
Posted: Tue Jul 21, 2015 1:31 pm
by declanr
dilip wrote:This powershell I have done already..I have done in my last project using powershell,but I was learning to do via TI processs.
RMackenzie's powershell solution would still be called from a TI process; and its the same concept with sendemail.exe where you are relying on something external to TM1 and passing pretty much the exact same parameters - so the amount of "TM1" involved in either would be approximately the same.
Re: Sending email using TI process
Posted: Tue Jul 21, 2015 4:11 pm
by dilip
Is it declanr!!.....Then I will try definately using powershell with TI process Thanks...This will be good idea...
Thanks Rmackenzie and declanr