EmailParser.WriteAttachment
---------------------------

Writes an attachment to a file path.

| Component | Version | macOS | Windows | Linux | Server | iOS SDK |
|---|---|---|---|---|---|---|
| [EmailParser](component_EmailParser.md) | [5.3](newinversion53.md) | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes |

MBS( "EmailParser.WriteAttachment"; EmailID; Index; Path ) 

**MBS**( **"EmailParser.WriteAttachment";** /\* Writes an attachment to a file path. \*/  
**$EmailID**; /\* The ID fo the email parser.e.g. $Email \*/   
**$Index**; /\* The index from 0 to [EmailParser.AttachmentCount](EmailParserAttachmentCount.md)-1.e.g. 0 \*/   
**$Path**) /\* Native file path.e.g. C:\\Documents\\Test.Txt \*/ 

### Parameters

| Parameter | Description | Example |
|---|---|---|
| EmailID | The ID fo the email parser. | $Email |
| Index | The index from 0 to [EmailParser.AttachmentCount](EmailParserAttachmentCount.md)-1. | 0 |
| Path | Native file path. | C:\\Documents\\Test.Txt |

### Result

Returns OK or error.

### Description

Writes an attachment to a file path.  
Our plugin decodes attachments for you, so the file should be directly useable.  
  
This function requires a native path. Use [Path.FileMakerPathToNativePath](PathFileMakerPathToNativePath.md) to convert a FileMaker path to a native path if required. If you like to have the user choose the path, you can use [FileDialog](component_FileDialog.md) functions.  
For Server be aware that server has limited permissions and may not be able to access all files on a computer.  
### See also

- [EmailParser.Attachment](EmailParserAttachment.md)
- [EmailParser.AttachmentCount](EmailParserAttachmentCount.md)
- [Path.FileMakerPathToNativePath](PathFileMakerPathToNativePath.md)

### Blog Entries

- [MBS Plugin Advent calendar: 23 - MailParser](https://www.mbsplugins.de/archive/2023-12-23/MBS_Plugin_Advent_calendar_23_/monkeybreadsoftware_blog_filemaker)

This function is free to use.

Created 24th September 2015 , last changed 24th September 2015

  
[EmailParser.Subject](EmailParserSubject.md) - [EmailParser.WriteInline](EmailParserWriteInline.md)

[HTML Version](EmailParserWriteAttachment.shtml)