Can anyone help in writing arrays into mailbody of outlook?

P.S. Mail body is html.
Also, order, error and Message is in form of array

Hi Team,

Please refer below information for your reference:

order1:
order2:

Error1:
Error2;

Message1:
Message2:

Regards,
ABCD

Hi @anjasing ,

This should give you a headstart:

<HTML>
<BODY>
<p>Hi Team,</p>

<p>Please refer below information for your reference:</p>

<div>order1:</div>
<div>order2:</div>
</br>
<div>Error1:</div>
<div>Error2;</div>
</br>
<div>Message1:</div>
<div>Message2:</div>
</br>
<p>Regards,</p>
<p>ABCD</p>
</BODY>
</HTML>

In your case, iterate through your array and build the html to the above.

Say for example you have 10 errors and 10 messages and at times we may not know the number of error or other values we have

So hope the below steps would help you resolve this

  1. Use a Assign activity and mention like this

str_top = “

Hi Team,

Please refer below information for your reference:

  1. Now create a temp string variable named str_temp in variable panel

  2. Then use a FOR EACH activity where pass you array variable having the value of orders and change the type argument as string

Inside the loop use a assign activity like this

str_temp = “

“+”Order “+(Array.IndexOf(arrayvariable,item)+1).ToString+item.ToString+”

And another assign activity like this

str_top = str_top+str_temp

  1. Now this loop will
    Keep on writing till last order value and also the HTML code

  2. outside to the above loop use a assign activity and mention like this

str_final = str_top + “<:/br>”

  1. Similarly use another FOR EACH Activity and pass the array variable for errors and change the type argument as string

  2. Same as above inside the loop use a assign activity like this

str_temp = “

“+”Errors “+(Array.IndexOf(arrayvariable,item)+1).ToString+item.ToString+”

  1. Same as above step
    str_final = str_final +str_temp

Hope this would help you handle dynamic number of values to place in array

Cheers @anjasing

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.