How can input a text under the fix position of the email body

Hi Everyone,

I need to input a text under the Button_PLACEHOLDER in the regular email body. What activity should I use and how can I build the process? Thanks.

Hello @Evelyn_Lu

I would do it like this:
str_MailBody being a String of the entire mailbody.
arr_MailBody being an Array(Of String)

Assign arr_MailBody = str_MailBody.Split("BUTTON_PLACEHOLDER")
Assign str_MailBody = arr_MailBody(0)+"<br>Text to add<br>"+arr_MailBody(1)

Regards
Soren

Put your email body into a variable and put {0} where you want the value replaced. Then do an assign…

Assign yourEmailBodyVar = String.Format(yourEmailBodyVar,varWithValueToInsert)

String.Format allows you to designate positions like {0} {1} {2} {3} etc in a string, and then replace those placeholders with values ie…

String.Format("String with placeholders {0} {1} {2} {3}","Value0","Value1","Value2","Value3")
…which would give the result…

String with placeholders Value0 Value1 Value2 Value3

2 Likes

@Evelyn_Lu,

I prefer using placeholders for this. In your raw or template text, just add a placeholder like ##Placeholder##

Once the placeholder is there, just replace it like this.

String.Replace("##Placeholder##","Your desired value")

1 Like

Keep the email body in a file with place holders. Before sending email - read the file and replace the place holders with actual value.

@Evelyn_Lu

  1. If this email is being created by you then use a placeholder like <PLACEHOLDER> or {0} for first variable and then with place holder use stringvariable.Replace("<PLACEHOLDER>","Value to be present") , if using strung formatter then string.Format(StringVariable,"Value to be presemt")
  2. If the email body is read from an email and then you need to replace then go with stringVariable.Replace("BUTTON_PLACEHOLDER","BUTTON_PLACEHOLDER" +Environment.NewLine+"value to be present")

Happy Automation

cheers

Hi Everyone,

Example: I need to input a wording"friendly reminder, please remember to add PO in shipment tag and upload the packing list during the booking" under the “Button” position, can you advise how I can build the process? Thanks.

@SorenB , should I use “Assign” and “Type into” activity?

Hi Everybody,

I use the hotkey “Tab” to locate the postion I want, thank you for your kind suggestions.Thanks.