Text.ReadEMLXFile
-----------------

Reads email text from emlx file.

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

MBS( "Text.ReadEMLXFile"; FilePath { ; Encoding } ) 

**MBS**( **"Text.ReadEMLXFile";** /\* Reads email text from emlx file. \*/  
**$FilePath**; /\* The native file path. Something like "/Users/cs/desktop/test.txt" on Mac and "C:\\Programs\\Data\\test.txt" on Windows. Files without path end in the root directory on Mac.e.g. "test.txt" \*/   
**$Encoding**) /\* Optional; The text encoding for result.   
Default is native. This function can also handle UTF-16 as well as UTF-16LE and UTF-16BE for little/big endian byte order.e.g. UTF8 \*/ 

### Parameters

| Parameter | Description | Example | Flags |
|---|---|---|---|
| FilePath | The native file path. Something like "/Users/cs/desktop/test.txt" on Mac and "C:\\Programs\\Data\\test.txt" on Windows. Files without path end in the root directory on Mac. | "test.txt" |  |
| Encoding | The text encoding for result.    Default is native. This function can also handle UTF-16 as well as UTF-16LE and UTF-16BE for little/big endian byte order.   Possible encoding names: ANSI, ISO-8859-1, Latin1, Mac, Native, UTF-8, DOS, Hex, Base64 or Windows. More listed in the [FAQ](https://www.monkeybreadsoftware.com/filemaker/faq.shtml). | UTF8 | Optional |

### Result

Returns text on success and error on failure.

### Description

Reads email text from emlx file.  
This function provides the raw text from an emlx file as Apple Mail uses them to store emails. You may need to use [Text.ReplaceNewLine](TextReplaceNewLine.md) function to change new line characters.  
You have to decide which encoding to use (if not native). We support a few encodings, but we can add more if you need something special.  
  
See also [Text.ReadTextFile](TextReadTextFile.md) for normal text files and eml files.  
### Examples

Read email file:

 # emlx test in file Contacts   
  
Set Variable \[ $path ; Value: "/Users/cs/Desktop/28213.emlx" \]   
Set Variable \[ $emailSourceText ; Value: MBS ( "Text.ReadEMLXFile"; $path ; "UTF-8") \]   
If \[ MBS ("IsError") = 0 \]   
 Set Variable \[ $email ; Value: MBS ( "[EmailParser.Parse](EmailParserParse.md)"; $EmailSourceText ; "UTF8") \]   
 If \[ MBS ("IsError") = 0 \]   
 Show Custom Dialog \[ "Email subject" ; MBS ( "[EmailParser.Subject](EmailParserSubject.md)"; $email ) \]   
 Set Variable \[ $r ; Value: MBS ( "[EmailParser.Release](EmailParserRelease.md)"; $email ) \]   
 End If  
End If  
### See also

- [EmailParser.Parse](EmailParserParse.md)
- [EmailParser.ParseContainer](EmailParserParseContainer.md)
- [EmailParser.ParseFile](EmailParserParseFile.md)
- [EmailParser.Release](EmailParserRelease.md)
- [EmailParser.Subject](EmailParserSubject.md)
- [IsError](IsError.md)
- [Text.ReadTextFile](TextReadTextFile.md)
- [Text.ReplaceNewLine](TextReplaceNewLine.md)

### Blog Entries

- [MBS FileMaker Plugin, version 5.3pr3](https://www.mbsplugins.de/archive/2015-09-15/MBS_FileMaker_Plugin_version_5/monkeybreadsoftware_blog_filemaker)

This function is free to use.

Created 14th September 2015 , last changed 23th May 2024

  
[Text.RTFToText](TextRTFToText.md) - [Text.ReadTextFile](TextReadTextFile.md)

[HTML Version](TextReadEMLXFile.shtml)