AddPart (Email subroutine): Difference between revisions
m (1 revision) |
mNo edit summary |
||
(3 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
{{Template:Email:AddPart subtitle}} | {{Template:Email:AddPart subtitle}} | ||
==Syntax== | ==Syntax== | ||
{{Template:Email:AddPart syntax}} | {{Template:Email:AddPart syntax}} | ||
===Syntax terms=== | ===Syntax terms=== | ||
<table class="syntaxTable"> | <table class="syntaxTable"> | ||
<tr><th> | <tr><th>email</th> | ||
<td> | <td>An <var>Email</var> object.</td></tr> | ||
</td></tr> | |||
<tr><th>content</th> | <tr><th>content</th> | ||
<td>A Stringlist or | <td>A <var>Stringlist</var> or <var>Longstring</var> that contains the attachment or body part. | ||
If a Stringlist is passed, each item in the Stringlist is delimited | If a <var>Stringlist</var> is passed, each item in the <var>Stringlist</var> is delimited | ||
with a carriage-return/line-feed (CR/LF) character pair. | with a carriage-return/line-feed (CR/LF) character pair. | ||
To override this line-ending, you can specify a non-text content type | To override this line-ending, you can specify a non-text content type | ||
as the value of the < | as the value of the <var>Type</var> optional argument, described below. | ||
In this case, no delimiter is added at the end of an item. | 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. | If a longstring is passed, no delimiters are added to the content.</td></tr> | ||
</td></tr> | |||
<tr><th> | <tr><th><var>Type</var></th> | ||
< | <td>This [[Notation conventions for methods#Named parameters|name required]] parameter is a string that specifies the MIME type of the content. MIME content-type strings consist of a primary type and a subtype delimited by a forward slash ( / ) character, for example, <code>text/xml</code>. | ||
<p> | |||
< | <var>AddPart</var> performs no validity checking, but it does distinguish | ||
< | between text MIME types ("text" is the primary type) and non-text types. | ||
If non-text, <var>AddPart</var> encodes the content in base64 format to ensure correct translation at SMTP gateways. | |||
that specifies the MIME type of the content. | You can override this encoding by specifying the <var>Encoding</var> option set to the value <var>None</var>. </p></td></tr> | ||
MIME content type strings consist | |||
of a primary type and a subtype delimited by a forward slash ( / ) character, | <tr><th><var>Encoding</var></th> | ||
for example, <code>text/xml</code>. | <td>This [[Notation conventions for methods#Name required parameters|name required]] parameter is a string that forces or suppresses encoding for the attachment. | ||
AddPart performs no validity checking, but it does distinguish | |||
between text MIME types ( | |||
If non-text, AddPart encodes the content in base64 format | |||
to ensure correct translation at SMTP gateways. | |||
You can override this encoding by specifying | |||
the <var>Encoding</var> option set to the value < | |||
< | |||
< | |||
that forces or suppresses encoding for the attachment. | |||
Since base64 encoding is automatically enabled for any non-text content, | Since base64 encoding is automatically enabled for any non-text content, | ||
the <var>Encoding</var> option is usually unnecessary. | the <var>Encoding</var> option is usually unnecessary. | ||
Line 49: | Line 38: | ||
not recommended: the likely result is that the recipient receives corrupt data, | not recommended: the likely result is that the recipient receives corrupt data, | ||
or otherwise the SMTP gateway may simply discard the message. | or otherwise the SMTP gateway may simply discard the message. | ||
< | |||
< | <tr><th><var>Name</var></th> | ||
provides a name for the attachment. | <td>This name required parameter is a string that provides a name for the attachment. The name is used when saving the attachment to a file. | ||
The name is used when saving the attachment to a file. | |||
< | <tr><th><var>Disposition</var></th> | ||
< | <td>This name required parameter, available as of <var class="product">Sirius Mods</var> version 7.6, provides a content-disposition header for the attachment. If you do not specify a disposition value, no content-disposition header is provided for the attachment. | ||
< | |||
< | |||
If you do not specify a | |||
is provided for the attachment. | |||
The method does no validity checking for the content-disposition, so you can specify whatever disposition you want. | |||
<tr><th><var>Description</var></th> | |||
<td>This name required parameter, available as of <var class="product">Sirius Mods</var> version 7.6, is a string that provides a content-description header for the attachment. If you do not specify a description value, no content-description header is provided for the attachment.</td></tr> | |||
</table> | |||
==Usage notes== | ==Usage notes== | ||
<ul> | <ul> | ||
<li>Subsequent invocations of the <var>AddPart</var> method add a separate attachment | <li>Subsequent invocations of the <var>AddPart</var> method add a separate attachment | ||
to the existing content. | to the existing content. | ||
<li>For a code example that includes the addition of an attachment, | <li>For a code example that includes the addition of an attachment, | ||
see [[ | see [[Email class#E-mail with attachment|"E-mail with attachment"]]. | ||
</ul> | </ul> | ||
==See also== | ==See also== | ||
{{Template:Email:AddPart footer}} | {{Template:Email:AddPart footer}} |
Latest revision as of 21:00, 14 August 2012
Add one or more attachments (Email class)
Syntax
email:AddPart( content, [Type= string], [Name= string], [Encoding= string], - [Disposition= string], [Description= string])
Syntax terms
An Email object. | |
content | A Stringlist or Longstring that contains the attachment or body part.
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, described below. 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. |
Type | This name required parameter is a string that specifies the MIME type of the content. MIME content-type strings consist of a primary type and a subtype delimited by a forward slash ( / ) character, for example, text/xml .
AddPart performs no validity checking, but it does distinguish between text MIME types ("text" is the primary type) and non-text types. If non-text, AddPart encodes the content in base64 format to ensure correct translation at SMTP gateways. You can override this encoding by specifying the Encoding option set to the value None. |
Encoding | This name required parameter is a string that forces or suppresses encoding for the attachment.
Since base64 encoding is automatically enabled for any non-text content,
the Encoding option is usually unnecessary.
To enable base64 encoding for text content, specify Specifying |
Name | This name required parameter is a string that provides a name for the attachment. The name is used when saving the attachment to a file. |
Disposition | This name required parameter, available as of Sirius Mods version 7.6, provides a content-disposition header for the attachment. If you do not specify a disposition value, no content-disposition header is provided for the attachment.
The method does no validity checking for the content-disposition, so you can specify whatever disposition you want. |
Description | This name required parameter, available as of Sirius Mods version 7.6, is a string that provides a content-description header for the attachment. If you do not specify a description value, no content-description header is provided for the attachment. |
Usage notes
- Subsequent invocations of the AddPart method add a separate attachment to the existing content.
- For a code example that includes the addition of an attachment, see "E-mail with attachment".