Topics
All
MacOS
(Only)
Windows
(Only)
Linux
(Only, Not)
iOS
(Only, Not)
Components
Crossplatform Mac & Win
Server
Client
Old
Deprecated
Guides
Examples
Videos
New in version:
9.3
9.4
9.5
10.0
10.1
10.2
10.3
10.4
10.5
10.6
Statistic
FMM
Blog
SendMail.SetHTMLText
Sets the HTML text of the new email.
| Component | Version | macOS | Windows | Linux | Server | FileMaker iOS SDK |
| SendMail | 4.3 | Yes | Yes | Yes | Yes | Yes |
Parameters
| Parameter | Description | Example |
|---|---|---|
| EmailID | The email reference number obtained using SendMail.CreateEmail function. | $EmailID |
| Text | The HTML text for the email. Will be encoded by the plugin to quoted printable UTF-8. | Email::HTMLText |
Result
Returns OK or error.
Description
Sets the HTML text of the new email.See also SendMail.SetPlainText and SendMail.SetRichText.
If you need to encode text yourself to html, you can use the Text.EncodeToHTML function.
You can read html content from file using the Text.ReplaceNewline function.
You can use Text.MergeFields to replace placeholders with values from variables, fields and expressions.
Examples
Create email and set content:
Set Variable [$EmailID; Value:MBS("SendMail.CreateEmail")]
Set Variable [$r; Value:MBS("SendMail.SetHTMLText"; $EmailID; $html)]
Sets the text as plain text and as html:
Set Variable [ $r ; Value: MBS("SendMail.SetHTMLText"; $EmailID; "<html><body>" & GetAsCSS(EMail::PlainText) & "</body></html>") ]
Set Variable [ $r ; Value: MBS("SendMail.SetPlainText"; $EmailID; EMail::PlainText) ]
Add inline graphics with placeholder in HTML:
Set Variable [ $EmailID ; Value: MBS("SendMail.CreateEmail") ]
# prepare HTML from field in FileMaker
Set Variable [ $html ; Value: "<html><body>" & GetAsCSS(EMail::PlainText) & "</body></html>" ]
# Replace $$img$$ in text with image.
Set Variable [ $html ; Value: Substitute($html; "$$img$$"; "<img src=\"cid:image1.png\">") ]
Set Variable [ $r ; Value: MBS("SendMail.SetHTMLText"; $EmailID; $html) ]
# now add a container
Set Variable [ $r ; Value: MBS("SendMail.AddAttachmentContainer"; $EmailID; EMail::ImageContainer; EMail::ImageName; "image/png"; "image1.png") ]
See also
- SendMail.AddAttachmentContainer
- SendMail.CreateEmail
- SendMail.GetHTMLText
- SendMail.GetRichText
- SendMail.PrepareCURL
- SendMail.SetPlainText
- SendMail.SetRichText
- Text.EncodeToHTML
- Text.MergeFields
- Text.ReplaceNewline
Example Databases
- CURL/Email/Batch Emailer
- CURL/Email/Build and send Email
- CURL/Email/Build and send HTML Email with inline graphic
Blog Entries
- Email Script for FileMaker
- Sending emails in FileMaker with MBS Plugin
- Sending Email with FileMaker via MBS Plugin
Created 3th September 2014, last changed 15th October 2018
SendMail.SetFrom - SendMail.SetInReplyTo
Feedback: Report problem or ask question.
Links
MBS FileMaker blog