Steve Strunk · Nov 1, 2022

Sending EMAIL - Change Font and Size

I have a module that sends EMAIL from a Cache INT routine (listed below).

In order to make sure the columns align in the body of the message that the recipient receives I want to force the setting of the FONT and SIZE in the body.

Does anyone know what I need to insert in this code in order to control font and size?

Alternatively is there a way to send mail from within Cache that will keep column data aligned?



s server=##class(%Net.SMTP).%New()

s server.smtpserver=server_name


s msg=##class(%Net.MailMessage)).%New()

s msg.from="from_email_address"

d msg.To.Insert("to_email_address"

d msg.TextData.WriteLine("column 1   column 2   column 3")

d msg.TextData.WriteLine("column1    column 2   column 3")

s status=server.Send(msg)

Product version: Caché 2018.1
$ZV: 2018.1.4
0 103
Discussion (2)2
Log in or sign up to continue

%Net.MailMessage has an IsHTML property; set that to a value of 1 and you can use HTML in your WriteLine() calls to format your text.

if Debug write "Createing message",!
set msg=##class(%Net.MailMessage).%New(),msg.From=objSource.sFromAddress
if objSource.IsHTML set msg.IsHTML=1
if msg.From="" set msg.From=objPostMaster.sFromAddress
set msg.Subject=objSource.sSubject


Now you can code any HTML format font you like

I notice you have no subject.