SetBody (Email subroutine): Difference between revisions
Jump to navigation
Jump to search
m (Created page with "This callable method allows you to add content to the body of an SMTP message. ==SetBody syntax== <p class="pre"> %email:SetBody(content, [options]) </p> ===Syntax terms=== <ta...") |
m (Created page with "This callable method allows you to add content to the body of an SMTP message. ==SetBody syntax== <p class="pre"> %email:SetBody(content, [options]) </p> ===Syntax terms=== <ta...") |
||
Line 1: | Line 1: | ||
{{Template:Email:SetBody subtitle}} | |||
This callable method allows you to add content to the body of an SMTP message. | This callable method allows you to add content to the body of an SMTP message. | ||
== | ==Syntax== | ||
{{Template:Email:SetBody syntax}} | |||
===Syntax terms=== | ===Syntax terms=== | ||
<table class="syntaxTable"> | <table class="syntaxTable"> | ||
Line 31: | Line 31: | ||
<var>SetBody</var> performs no validity checking, but it does distinguish | <var>SetBody</var> performs no validity checking, but it does distinguish | ||
between text MIME types (“text” is the primary type) and non-text types. | between text MIME types (&ldquo;text&rdquo; is the primary type) and non-text types. | ||
If non-text, <var>SetBody</var> encodes the content in base64 format | If non-text, <var>SetBody</var> encodes the content in base64 format | ||
to ensure correct translation at SMTP gateways. | to ensure correct translation at SMTP gateways. | ||
Line 56: | Line 56: | ||
</td></tr></table> | </td></tr></table> | ||
==Usage | ==Usage notes== | ||
Subsequent invocations of the <var>SetBody</var> method completely replace any | Subsequent invocations of the <var>SetBody</var> method completely replace any | ||
Line 81: | Line 81: | ||
[[SMTP Helper#E-mail with attachment|"E-mail with attachment"]]. | [[SMTP Helper#E-mail with attachment|"E-mail with attachment"]]. | ||
</ul> | </ul> | ||
==See also== | |||
{{Template:Email:SetBody footer}} |
Revision as of 21:41, 5 July 2011
Add body content to the message (Email class)
This callable method allows you to add content to the body of an SMTP message.
Syntax
email:SetBody( content, [Type= string], [Name= string], [Encoding= string])
Syntax terms
A previously declared Email object. | |
content | A Stringlist or Longstring that contains the actual e-mail body.
If a Stringlist is passed, each item in the Stringlist is delimited with a carriage-return/line-feed (CR/LF) character pair. To override this line-ending, you can specify a non-text content type as the value of the Type optional argument. In this case, no delimiter is added at the end of an item. If a longstring is passed, no delimiters are added to the content. |
options | Any combination of the following options. Each may be specified only once.
|
Usage notes
Subsequent invocations of the SetBody method completely replace any
existing content.
Examples
- The following code fragment adds HTML text to the to the body of an
SMTP message:
... %greet is object Email %sl is object Stringlist html to %sl <html>
Hello world!
</html> end html %greet:SetBody(%sl, type='text/html') ...
- For SetBody method examples, see "Basic e-mail" and "E-mail with attachment".