Sending HTML in SMTP Email, variable not being interpreted

I am trying to send the following in an “SMTP Send Mail Message” ( with the “Is Body HTML” checked ), and am getting errors. It either shows the variable but not the plain text, or else I can get it to show the plain text but not interpret the variable. I am currently passing it as a String and thought maybe I was going about it wrong. I have attached my workflow and excel doc that I am trying to use. Thanks for helping! :slight_smile:

”+Hi, Welcome To Pen Pals,+’"+firstChildsName.toString+’"+has been matched!"

SelectingRowsFromExcelMain.xaml (23.4 KB)
Pen Pals 2018-JOSH-TEST.xlsx (60.6 KB)

Try this @Joshua_Kemp
“Hi”+","+“Welcome TO Pen Pals”+","+firstChildsName.toString+“has been matched!”

1 Like

Thanks so much for taking the time to answer my question, it works! The only thing is I need to make the “firstChildsName” bold tags. I want to add some HTML formatting like
and a hyperlink later on.

I apologize, I thought I sent the correct message, here is what I am trying to send in the email:

 "<p>"+Hi, Welcome To Pen Pals,+'<b>"+firstChildsName.toString+'</b>"+has been matched!"</p></br>"


I looked and I’m not sure why you are using XElement variable type but if you set your EmailMessage variable to a string and use the code below in your assign activity it should get you going in the right track.

 "<p>Hi, Welcome to Pen Pals, <b>"+FirstChildsName.ToString+"</b> has been matched!</p>"

If you had a reason you need to use XElement it may be possible but I don’t have any experience with that variable type.


That did it! I had it originally as a string and then was reading some articles on this forum and thought maybe I needed it as an XElement ( forgot to change it back ). Thanks so much for your help, I really appreciate it!

Hi @Joshua_Kemp,
As i under stand your xml . I have changed it something with workflowInvoke. May be . It will helpful to you.

Note : Email Boby is Custome. It reads from text file.In future , if you want , you can change it.

File : (42.8 KB)



Thanks for taking the time to review and answer my question and for including a helpful workflow! Thanks so much Balamurugan!

1 Like

Hey Tyler,
Everything is working well except when I read the email it has an extra quote at the end of each line like this:


Here is how I am formatting the HTML:

"<span><br>Hi, Welcome To Pen Pals, <b>"+firstChildsName.toString+"</b> has been 
        matched!</span></br>""<span><br><br>Here is your Pen Pal's information: </br></br> 

Any thoughts? I changed to span tags because they seemed to format better. Thanks!

Hey Joshua,

I think if you take out the double quotes between the br and span tags it will remove the unneeded quotes in the body of the email. Holler if that doesn’t fix it (I’m an HTML novice but it worked in my automation).

 "<span><br>Hi, Welcome To Pen Pals, <b>"+firstChildsName.toString+"</b> has been matched!</span></br><span><br><br>Here is your Pen Pal's information: </br></br></span>"

Thanks man, worked great! Hope I can help you down the road :slight_smile:

1 Like