EmailParser.Address
-------------------

Queries an address value.

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

MBS( "EmailParser.Address"; EmailID; Index; Selector ) 

**MBS**( **"EmailParser.Address";** /\* Queries an address value. \*/  
**$EmailID**; /\* The ID fo the email parser.e.g. $Email \*/   
**$Index**; /\* The index from 0 to [EmailParser.AddressCount](EmailParserAddressCount.md)-1.e.g. 0 \*/   
**$Selector**) /\* Which value to return. Can be type, name or email.e.g. "name" \*/ 

### Parameters

| Parameter | Description | Example |
|---|---|---|
| EmailID | The ID fo the email parser. | $Email |
| Index | The index from 0 to [EmailParser.AddressCount](EmailParserAddressCount.md)-1. | 0 |
| Selector | Which value to return. Can be type, name or email. | "name" |

### Result

Returns value or error.

### Description

Queries an address value.  
An address has a type which can be TO, CC, BCC, ReplyTo, Sender or From.  
Name is the label which can be empty. Email is the email address.  
### Examples

Copy all addresses into records:

 #find all addresses   
Set Variable \[$EmailRecordID ; Value:Get(RecordID)\]  
Set Variable \[$i ; Value:0\]  
Set Variable \[$c ; Value:MBS ("[EmailParser.AddressCount](EmailParserAddressCount.md)"; $email )\]  
If \[$c &gt; 0\]  
 Go to Related Record \[Show only related records; From table: “Address”; Using layout: “Address” (Address)\]  
 Go to Layout \[“Address” (Address)\]  
 Delete All Records \[No dialog\]  
 Loop  
 Set Variable \[$Name ; Value:MBS ("EmailParser.Address"; $email ; $i ; "name")\]  
 Set Variable \[$emailAddress ; Value:MBS ("EmailParser.Address"; $email ; $i ; "email")\]  
 Set Variable \[$type ; Value:MBS ("EmailParser.Address"; $email ; $i ; "type")\]  
 New Record/Request  
 Set Field \[Address::Type ; $type \]  
 Set Field \[Address::Email ; $emailAddress \]  
 Set Field \[Address::Name ; $name \]  
 Set Field \[Address::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.AddressCount](EmailParserAddressCount.md)
- [EmailParser.Parse](EmailParserParse.md)

### Example Databases

- [CURL/Email/Email Client](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/CURL/Email/Email%20Client.shtml#1ScriptAnchor_)
- [CURL/Email/Email Parser and Preview](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/CURL/Email/Email%20Parser%20and%20Preview.shtml#1ScriptAnchor_)
- [CURL/Email/Email Parser](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/CURL/Email/Email%20Parser.shtml#1ScriptAnchor_)
- [CURL/Email/IMAP Email](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/CURL/Email/IMAP%20Email.shtml#4ScriptAnchor_)

### 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 16th October 2015

  
[Email.Verify](EmailVerify.md) - [EmailParser.AddressCount](EmailParserAddressCount.md)

[HTML Version](EmailParserAddress.shtml)