Possible to provide line space in comments?

Post Reply
vino1493
Posts: 30
Joined: Tue Mar 14, 2017 12:01 pm
OLAP Product: cognos tm1
Version: 10.2.2
Excel Version: excel 2013

Possible to provide line space in comments?

Post by vino1493 »

I'm trying to send to email notification using powershell. For the email's body I wish to add line space to look something like below
Hi All,

Load has completed.

My current code is

sSubject = ' load completed' ;
sBody = ' load completed';

# build powershell command
sPsCmd = '"& {
Send-MailMessage
-From ' | sFrom | '
-To ' | sTo | '
-cc ' | sCC | '
-Subject ' | '\"' | sSubject | '\"
-Body ' | '\"' | sBody | '\"
-SmtpServer ' | sSmtpServer | '
}"';

# execute command
ExecuteCommand ( 'powershell.exe -command ' | sPsCmd, 1 );


Is it possible to add line space to email's 'sBody' part?
Many space bars can be added as a workaround but this there a right way to do it?

Note:I didn't share few variable in the above code please ignore those
tm123
Posts: 132
Joined: Thu Oct 23, 2014 10:15 pm
OLAP Product: tm1, cognos bi
Version: 10.2
Excel Version: 2010

Re: Possible to provide line space in comments?

Post by tm123 »

vino1493 wrote: Wed Mar 28, 2018 2:40 pm I'm trying to send to email notification using powershell. For the email's body I wish to add line space to look something like below
Hi All,

Load has completed.

My current code is

sSubject = ' load completed' ;
sBody = ' load completed';

# build powershell command
sPsCmd = '"& {
Send-MailMessage
-From ' | sFrom | '
-To ' | sTo | '
-cc ' | sCC | '
-Subject ' | '\"' | sSubject | '\"
-Body ' | '\"' | sBody | '\"
-SmtpServer ' | sSmtpServer | '
}"';

# execute command
ExecuteCommand ( 'powershell.exe -command ' | sPsCmd, 1 );


Is it possible to add line space to email's 'sBody' part?
Many space bars can be added as a workaround but this there a right way to do it?

Note:I didn't share few variable in the above code please ignore those
You can add another option called BodyAsHtml, and then you can include HTML Tags on the Email Body

sPsCmd = '"& {
Send-MailMessage
-From ' | sFrom | '
-To ' | sTo | '
-Subject ' | '\"' | sSubject | '\"
-Body ' | '\"' | sBody | '\"
-BodyAsHtml -SmtpServer ' | sSmtpServer | '
}"';
vino1493
Posts: 30
Joined: Tue Mar 14, 2017 12:01 pm
OLAP Product: cognos tm1
Version: 10.2.2
Excel Version: excel 2013

Re: Possible to provide line space in comments?

Post by vino1493 »

Yeah that function will help, thank you so much for bringing it up.
vino1493
Posts: 30
Joined: Tue Mar 14, 2017 12:01 pm
OLAP Product: cognos tm1
Version: 10.2.2
Excel Version: excel 2013

Re: Possible to provide line space in comments?

Post by vino1493 »

Developed the below code and it is working as expected!

Code: Select all

  sSubject = 'WD-' | vDay | ' load completed ' ;
  sBody = '
	<body>
	  Hi All,
	  <br>
	  <br>
	</body>' | 'load started ';

# build powershell command
  sPsCmd = '"& {
  Send-MailMessage 
  -From ' | sFrom | ' 
  -To ' | sTo | ' 
  -cc ' | sCC | ' 
  -Subject ' | '\"' | sSubject | '\"
  -Body ' | '\"' | sBody | '\"
  -BodyAsHtml -SmtpServer ' | sSmtpServer | ' 
  }"';

# execute command
  ExecuteCommand ( 'powershell.exe -command ' | sPsCmd, 1 );
Last edited by vino1493 on Thu Feb 21, 2019 5:10 pm, edited 1 time in total.
User avatar
macsir
MVP
Posts: 782
Joined: Wed May 30, 2012 6:50 am
OLAP Product: TM1
Version: PAL 2.0.9
Excel Version: Office 365
Contact:

Re: Possible to provide line space in comments?

Post by macsir »

I am using Powershell as well but I wrap the send email function to sendemail.ps1 file to accept parameters from TI processes.
In TM1,the answer is always yes though sometimes with a but....
http://tm1sir.blogspot.com.au/
Sophie Kay
Posts: 4
Joined: Wed Apr 04, 2018 10:21 am
OLAP Product: HOLAP
Version: 8.1
Excel Version: 2017

Re: Possible to provide line space in comments?

Post by Sophie Kay »

Yeah, I was looking for an explanation, thanks)
Post Reply