SendMail.SetSMTPUserName
------------------------

Sets the username for SMTP server authentication.

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

MBS( "SendMail.SetSMTPUserName"; EmailID; UserName ) 

**MBS**( **"SendMail.SetSMTPUserName";** /\* Sets the username for SMTP server authentication. \*/  
**$EmailID**; /\* The email reference number obtained using [SendMail.CreateEmail](SendMailCreateEmail.md) function. \*/   
**$UserName**) /\* Sets the username for SMTP server.e.g. "user@mbsplugins.de" \*/ 

### Parameters

| Parameter | Description | Example |
|---|---|---|
| EmailID | The email reference number obtained using [SendMail.CreateEmail](SendMailCreateEmail.md) function. | $EmailID |
| UserName | Sets the username for SMTP server. | "user@mbsplugins.de" |

### Result

Returns OK or error.

### Description

Sets the username for SMTP server authentication.  
Alternative to this method you can set [CURL.SetOptionUserName](CURLSetOptionUserName.md) yourself later.  
### Examples

Start new email and setup SMTP login:

 Set Variable \[$EmailID ; Value:MBS ("[SendMail.CreateEmail](SendMailCreateEmail.md)")\]  
Set Variable \[$r ; Value:MBS ("[SendMail.SetSMTPServer](SendMailSetSMTPServer.md)"; $EmailID ; EMail::SMTP Server; EMail::SMTP SSL)\]  
Set Variable \[$r ; Value:MBS ("SendMail.SetSMTPUsername"; $EmailID ; EMail::SMTP Username)\]  
Set Variable \[$r ; Value:MBS ("[SendMail.SetSMTPPassword](SendMailSetSMTPPassword.md)"; $EmailID ; EMail::SMTP Password)\]  
### See also

- [CURL.SetOptionUserName](CURLSetOptionUserName.md)
- [CURL.SetOptionXOAuth2Bearer](CURLSetOptionXOAuth2Bearer.md)
- [SendMail.CreateEmail](SendMailCreateEmail.md)
- [SendMail.GetSMTPUserName](SendMailGetSMTPUserName.md)
- [SendMail.PrepareCURL](SendMailPrepareCURL.md)
- [SendMail.SetSMTPPassword](SendMailSetSMTPPassword.md)
- [SendMail.SetSMTPServer](SendMailSetSMTPServer.md)

### 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)
- [SMTP with OAuth for Office 365 in FileMaker](https://www.mbsplugins.de/archive/2022-11-22/SMTP_with_OAuth_for_Office_365/monkeybreadsoftware_blog_filemaker)
- [Sending email with a huge custom function](https://www.mbsplugins.de/archive/2021-06-26/Sending_email_with_a_huge_cust/monkeybreadsoftware_blog_filemaker)
- [GMail for emails with MBS Plugin](https://www.mbsplugins.de/archive/2021-04-18/GMail_for_emails_with_MBS_Plug/monkeybreadsoftware_blog_filemaker)
- [Use Inline Graphics in Emails](https://www.mbsplugins.de/archive/2021-02-11/Use_Inline_Graphics_in_Emails/monkeybreadsoftware_blog_filemaker)
- [Email Script for FileMaker](https://www.mbsplugins.de/archive/2018-10-10/Email_Script_for_FileMaker/monkeybreadsoftware_blog_filemaker)
- [Comparing Base Elements Plugin to MBS FileMaker Plugin](https://www.mbsplugins.de/archive/2017-10-24/Comparing_Base_Elements_Plugin/monkeybreadsoftware_blog_filemaker)
- [Sending emails in FileMaker with MBS Plugin](https://www.mbsplugins.de/archive/2016-10-03/Sending_emails_in_FileMaker_wi/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 3th September 2014 , last changed 9th January 2017

  
[SendMail.SetSMTPServer](SendMailSetSMTPServer.md) - [SendMail.SetSubject](SendMailSetSubject.md)

[HTML Version](SendMailSetSMTPUserName.shtml)