Components | All | New | MacOS | Windows | Linux | iOS | ||||
Examples | Mac & Win | Server | Client | Guides | Statistic | FMM | Blog | Deprecated | Old |
MailComposer.AddAttachmentContainer
Adds an attachment to the email based on a container field.
Component | Version | macOS | Windows | Linux | Server | iOS SDK |
MailComposer | 7.3 | ❌ No | ❌ No | ❌ No | ❌ No | ✅ Yes |
Parameters
Parameter | Description | Example | Flags |
---|---|---|---|
Container | The container to attach to email. | Attachment::Container | |
Name | The name for the attachment. | "sample.pdf" | |
MimeType | The mime type to use. e.g. "application/pdf" for PDF files. If missing, we use "application/octet-stream". | "application/octet-stream" | Optional |
Result
Returns OK or error.
Description
Adds an attachment to the email based on a container field.You can use Text.FileExtensionToMimeType to find the mime type for a file extension.
You can use AddAttachment several times to add several attachments.
Examples
Adds an attachment:
Set Variable [ $FieldName ; Value: Get(ScriptParameter) ]
Set Variable [ $Container ; Value: GetField ( $FieldName) ]
If [ IsEmpty ( $container ) = 0 ]
Set Variable [ $path ; Value: GetAsText ( $Container ) ]
Set Variable [ $name ; Value: MBS( "Path.LastPathComponent"; $path) ]
Set Variable [ $extension ; Value: MBS( "Files.FileExtension"; $name ) ]
Set Variable [ $mimeType ; Value: MBS( "Text.FileExtensionToMimeType"; $extension ) ]
#
Set Variable [ $r ; Value: MBS( "MailComposer.AddAttachmentContainer"; $container; $name; $mimeType) ]
End If
See also
- Files.FileExtension
- MailComposer.AddAttachmentFile
- MailComposer.AddAttachmentText
- MessageComposer.AddAttachmentContainer
- Path.LastPathComponent
- Text.FileExtensionToMimeType
Example Databases
This function checks for a license.
Created 10th June 2017, last changed 10th June 2017