Applies to
Description
Gets or sets the message body in HTML format, which may link to any LinkedResources.
Usage
In scripts
The HtmlBody takes a string value. The following example sets the email information and the HTML linked resource.
Integer li_rc
String ls_linkedResources, ls_contentID,ls_HTML
SMTPClient lnv_SmtpClient
lnv_SmtpClient = CREATE SMTPClient
//set the email account information
lnv_SmtpClient.Host = "smtp.gmail.com"
lnv_SmtpClient.Port = 587
lnv_SmtpClient.Username = "tester001.appeon@gmail.com"
lnv_SmtpClient.password = "Mypassword001"
lnv_SmtpClient.EnableTLS = True
lnv_SmtpClient.LogFile("c:\mail.log")
//set the email message
lnv_SmtpClient.Message.SetSender("tester001.appeon@gmail.com","Tester001")
lnv_SmtpClient.Message.AddRecipient("tester002.appeon@gmail.com")
lnv_SmtpClient.Message.Subject = "SMTPClient Test Message"
//set the HTML linked resource
ls_linkedResources = "c:\\image\\appeon.jpg"
ls_contentID = "CID001"
lnv_SmtpClient.Message.AddLinkedResource(ls_linkedResources, ls_contentID)
ls_HTML = &
"<html><body>" + "~r~n" + &
"<p>This is the inline " + "~r~n" + &
"<b>HTML</b> message of the e-mail.</p><br />" + "~r~n" + &
"<img src='cid:" + ls_contentID + "'/>" + "~r~n" + &
"</body></html>"
lnv_SmtpClient.Message.HTMLBody = ls_HTML
//send the email
li_rc = lnv_SmtpClient.Send()
IF li_rc = 1 THEN
Messagebox('SMTPClient','Mail sent successfully')
ELSE
Messagebox('SMTPClient' ,'Email sending failed. Return ' + String(li_rc) + '.', StopSign!)
END IF
DESTROY lnv_SmtpClient
The following example sets the local HTML file as the email message body.
li_FileNum = FileOpen("c:\test.html",TextMode!)
FileReadEx(li_FileNum, ls_HTML)
lnv_SmtpClient.Message.HTMLBody = ls_HTML


