Placing variable into HTML email

scripting
#1

I have a variable of type string called “self.custom.var” that I want to put into an HTML email.

body = "<HTML><BODY><H2>Your variable is + self.custom.var</H2>"

I have also tried

body = "<HTML><BODY>
<p>Your variable is: <br>
<br><br><h1> {help_me} </H1><br>
<p>"
body.format(help_me = self.custom.var)

I can’t seem to figure this out. Any hints?

Thank you,

0 Likes

#2

try
body = "<HTML><BODY><H2>Your variable is" + self.custom.var + "</H2>"
This does assume self.custom.var is a string type. If it’s not then you can cast it like
body = "<HTML><BODY><H2>Your variable is" + str(self.custom.var) + "</H2>"

0 Likes

#3

This solved it! Thank you very much!

0 Likes