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
EmailParser.Attachment
Queries an attachment property.
| Component | Version | macOS | Windows | Linux | Server | FileMaker iOS SDK |
| EmailParser | 5.3 | Yes | Yes | Yes | Yes | Yes |
Parameters
| Parameter | Description | Example | Flags |
|---|---|---|---|
| EmailID | The ID fo the email parser. | ||
| Index | The index from 0 to EmailParser.AttachmentCount-1. | 0 | |
| Selector | Which value to return. Can be Filename, MimeType, MimeVersion, ContentType, ContentTransferEncoding, ContentDisposition, ContentDescription, contentId, text or container. | "Filename" | |
| Extra | For selector = container, you can pass an alternative file name. For selector = text, you can pass text encoding here. |
Optional |
Result
Returns value or error.
Description
Queries an attachment property.You can query for example the file name or the mime type.
For storing in a container, you can query the container property. The attachment is decoded by the plugin.
If you need to directly write to a file, you can use the EmailParser.WriteAttachment function.
You can use Text.MimeTypeToFileExtension to find the file extension for mime type.
Examples
Copy all attachments into records:
#find all attachments
Set Variable [$i; Value:0]
Set Variable [$c; Value:MBS("EmailParser.AttachmentCount"; $email)]
If [$c > 0]
Go to Related Record [Show only related records; From table: “Attachment”; Using layout: “Attachment” (Attachment)]
Go to Layout [“Attachment” (Attachment)]
Delete All Records [No dialog]
Loop
Set Variable [$Name; Value:MBS("EmailParser.Attachment"; $email; $i; "filename")]
Set Variable [$content; Value:MBS("EmailParser.Attachment"; $email; $i; "container")]
New Record/Request
Set Field [Attachment::Content; $content]
Set Field [Attachment::FileName; $name]
Set Field [Attachment::EmailID; $EmailRecordID]
Commit Records/Requests [Skip data entry validation; No dialog]
#next
Set Variable [$i; Value:$i + 1]
Exit Loop If [$i = $c]
End Loop
End If
See also
- EmailParser.AttachmentCount
- EmailParser.Parse
- EmailParser.WriteAttachment
- Text.MimeTypeToFileExtension
Example Databases
Blog Entries
Release notes
- Version 9.3
- Added parameter for EmailParser.Inline or EmailParser.Attachment to pass text encoding or file name.
Created 24th September 2015, last changed 14th July 2019
EmailParser.AttachedEmails - EmailParser.AttachmentCount
Feedback: Report problem or ask question.
Links
MBS Xojo Chart Plugins