WinSendMail.CreateEmail
-----------------------

Creates a new email.

| Component | Version | macOS | Windows | Linux | Server | iOS SDK |
|---|---|---|---|---|---|---|
| [WinSendMail](component_WinSendMail.md) | [7.1](newinversion71.md) | ❌ No | ✅ Yes | ❌ No | ❌ No | ❌ No |

MBS( "WinSendMail.CreateEmail" ) ### Parameters

none

### Result

Returns email number or error.

### Description

Creates a new email.  
The reference number returned by this function can be passed to other plugin functions for setting up the email.  
Later use [WinSendMail.Release](WinSendMailRelease.md) to free memory.  
SendMail reference numbers are starting at 67000 and counting up for each new email.  
### Examples

Send an email with values from field:

 Set Variable \[ $email ; Value:MBS ( "WinSendMail.CreateEmail" ) \]  
Set Variable \[ $r ; Value:MBS ( "[WinSendMail.AddTo](WinSendMailAddTo.md)"; $email ; Send::To Email ; Send::To Name ) \]  
Set Variable \[ $r ; Value:MBS ( "[WinSendMail.AddCC](WinSendMailAddCC.md)"; $email ; Send::CC Email ; Send::CC Name ) \]  
Set Variable \[ $r ; Value:MBS ( "[WinSendMail.SetFrom](WinSendMailSetFrom.md)"; $email ; Send::From Email ; Send::From Name ) \]  
Set Variable \[ $r ; Value:MBS ( "[WinSendMail.SetSubject](WinSendMailSetSubject.md)"; $email ; Send::Subject ) \]  
Set Variable \[ $r ; Value:MBS ( "[WinSendMail.SetText](WinSendMailSetText.md)"; $email ; Send::Text ) \]  
Set Variable \[ $r ; Value:MBS ( "[WinSendMail.Send](WinSendMailSend.md)"; $email ) \]  
If \[ MBS ("IsError") \]  
 Show Custom Dialog \[ Title: "Failed to send email"; Message: $r ; Default Button: “OK”, Commit: “Yes”; Commit: “No” \]  
Else  
 Pause/Resume Script \[ Duration (seconds): 2 \]  
End If  
Set Variable \[ $r ; Value:MBS ( "[WinSendMail.Release](WinSendMailRelease.md)"; $email ) \]  
### See also

- [IsError](IsError.md)
- [SendMail.CreateEmail](SendMailCreateEmail.md)
- [SendMail.SetFrom](SendMailSetFrom.md)
- [SendMail.SetSubject](SendMailSetSubject.md)
- [WinSendMail.AddAttachmentText](WinSendMailAddAttachmentText.md)
- [WinSendMail.AddCC](WinSendMailAddCC.md)
- [WinSendMail.AddTo](WinSendMailAddTo.md)
- [WinSendMail.Release](WinSendMailRelease.md)
- [WinSendMail.Send](WinSendMailSend.md)
- [WinSendMail.SetSubject](WinSendMailSetSubject.md)

### Example Databases

- [Win Only/Send Email via Email Application](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/Win%20Only/Send%20Email%20via%20Email%20Application.shtml#1ScriptAnchor_)

This function checks for a license.

Created 28th February 2017 , last changed 25th November 2019

  
[WinSendMail.ClearRecipients](WinSendMailClearRecipients.md) - [WinSendMail.GetSubject](WinSendMailGetSubject.md)

[HTML Version](WinSendMailCreateEmail.shtml)