SendMail.AddRecipient
---------------------

Adds a recipient.

| Component | Version | macOS | Windows | Linux | Server | iOS SDK |
|---|---|---|---|---|---|---|
| [SendMail](component_SendMail.md) | [4.3](newinversion43.md) | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes |

MBS( "SendMail.AddRecipient"; EmailID; Type; Email { ; Name } ) 

**MBS**( **"SendMail.AddRecipient";** /\* Adds a recipient. \*/  
**$EmailID**; /\* The email reference number obtained using [SendMail.CreateEmail](SendMailCreateEmail.md) function. \*/   
**$Type**; /\* The type of recipient. Can be TO, BCC, CC or ReplyTo.e.g. "CC" \*/   
**$Email**; /\* The email address of the recipient.e.g. "test@mbsplugins.de" \*/   
**$Name**) /\* Optional; Optional the name of the recipient. If this name contains special characters, it will be automatically encoded with UTF-8.e.g. "John Miller" \*/ 

### Parameters

| Parameter | Description | Example | Flags |
|---|---|---|---|
| EmailID | The email reference number obtained using [SendMail.CreateEmail](SendMailCreateEmail.md) function. | $EmailID |  |
| Type | The type of recipient. Can be TO, BCC, CC or ReplyTo. | "CC" |  |
| Email | The email address of the recipient. | "test@mbsplugins.de" |  |
| Name | Optional the name of the recipient. If this name contains special characters, it will be automatically encoded with UTF-8. | "John Miller" | Optional |

### Result

Returns OK or error.

### Description

Adds a recipient.  
This function can be used easily if the type is also a field in your database.  
As an alternative you can of course also use [SendMail.AddTo](SendMailAddTo.md), [SendMail.AddReplyTo](SendMailAddReplyTo.md), [SendMail.AddCC](SendMailAddCC.md) or [SendMail.AddBCC](SendMailAddBCC.md).  
  
You can call this in a loop several times to add as many recipients as needed.  
Please make sure the email addresses are syntactically correct.  
### Examples

Add email address for a carbon copy:

 MBS ( "SendMail.AddRecipient"; $email ; "CC"; "test@mbsplugins.de"; "Bob Miller")  
### See also

- [SendMail.AddBCC](SendMailAddBCC.md)
- [SendMail.AddCC](SendMailAddCC.md)
- [SendMail.AddReplyTo](SendMailAddReplyTo.md)
- [SendMail.AddTo](SendMailAddTo.md)
- [SendMail.ClearRecipients](SendMailClearRecipients.md)
- [SendMail.CreateEmail](SendMailCreateEmail.md)
- [WinSendMail.AddBCC](WinSendMailAddBCC.md)
- [WinSendMail.AddCC](WinSendMailAddCC.md)
- [WinSendMail.AddRecipient](WinSendMailAddRecipient.md)
- [WinSendMail.AddTo](WinSendMailAddTo.md)

### Release notes

- **Version 12.0**
    - Fixed a problem with [WinSendMail.AddBCC](https://www.mbsplugins.eu/WinSendMailAddBCC.shtml), [WinSendMail.AddCC](https://www.mbsplugins.eu/WinSendMailAddCC.shtml), [WinSendMail.AddRecipient](https://www.mbsplugins.eu/WinSendMailAddRecipient.shtml), [WinSendMail.AddTo](https://www.mbsplugins.eu/WinSendMailAddTo.shtml) not passing email when name is empty.

### Blog Entries

- [MBS FileMaker Advent calendar - Door 12 - Sending Mails](https://www.mbsplugins.de/archive/2024-12-12/MBS_FileMaker_Advent_calendar_/monkeybreadsoftware_blog_filemaker)
- [MBS Plugin Advent calendar: 21 - SendMail](https://www.mbsplugins.de/archive/2023-12-21/MBS_Plugin_Advent_calendar_21_/monkeybreadsoftware_blog_filemaker)
- [Use Inline Graphics in Emails](https://www.mbsplugins.de/archive/2021-02-11/Use_Inline_Graphics_in_Emails/monkeybreadsoftware_blog_filemaker)
- [Sending Email with FileMaker via MBS Plugin](https://www.mbsplugins.de/archive/2014-09-29/Sending_Email_with_FileMaker_v/monkeybreadsoftware_blog_filemaker)

### FileMaker Magazin

- [Ausgabe 6/2024, Seite 38](https://filemaker-magazin.de/neuigkeit/4277-Appetithappen-FMM_202406)
- [Ausgabe 5/2014, Seite 26](https://filemaker-magazin.de/neuigkeit/3759-Appetithappen-FMM_201405)

This function checks for a license.

Created 5th September 2014 , last changed 9th September 2019

  
[SendMail.AddHeader](SendMailAddHeader.md) - [SendMail.AddReplyTo](SendMailAddReplyTo.md)

[HTML Version](SendMailAddRecipient.shtml)