Question
Jordan Everett · Aug 1

Email Template

Does anyone have any pointers or maybe familiarity of making Email templates in Objectscript?

I'm currently trying to implement Televisits with our system and am needing to send an email to the patient. I'd like to make it a nicer looking email which will require a good amount of inline CSS. I currently have a method, but is very much a sore sight for the eyes.

I was wondering if there was a way I could use Embedded HTML and pass that into the DO msg.TextData.Write command with the ##class(%Net.MailMessage)? 

Product version: HealthShare 2017.2
$ZV: 2017.2.2 Build 865_3_20793U
0
0 161
Discussion (2)1
Log in or sign up to continue

Hi Jordan!

You can write the html as if it were a string inside TextData.Write()

Set tEmail = ##class(%Net.MailMessage).%New()
Set tEmail.IsHTML=1
		
Set tSC = tEmail.TextData.Write("<h2 style='color: #5e9ca0;'>Hello World!</h2>")
Set tSC = ..Adapter.SendMail(tEmail)

Hope this helps :)

Yea I was wondering if I can maybe format in a  bit of a nicer way to where it'd be readable kind of like this:

set tEmail = ##class(%Net.MailMessage).%New()

set tEmail.IsHTML=1

set html = &html<

<html>

<body>

<b>Hello, World!</b>

</body>

</html>

>

set tSC = tEmail.TextData.Write(html)

set tSC=..Adapater.SendMail(tEmail)

I know you can't assign embedded HTML to a variable, but I didn't know if there was a different way of doing it.

I think I did find a work around however by using SendGrid and just doing a JSON post to SendGrid that will send my email through the use of a template, but I guess it is just moreso for curiosity sakes now.