
Description
Use the Send SMTP Email Node to send an email via an SMTP connection to a recipient.Parameters
Email Service Configuration
Email Service Configuration
Some email providers, such as Gmail, require you to configure your mail account to allow sending mail via SMTP before you can use it.
Authentication
Authentication
You can use one of the following authentication methods:
- OAuth2 Client Credentials (recommended)
- OAuth2 (deprecated)
- Basic Auth
OAuth2 Client Credentials is a token-based authentication method. It uses a client ID and client secret to obtain an access token and authenticate with the email provider. This authentication method provides a higher level of security than Basic Auth and doesn’t require refresh tokens.To create a connection, follow these steps:
- Next to the OAuth2 Client Credentials Parameters setting, click +.
- Add a new connection or use an existing one:
- Connection name — enter a unique connection name.
- Token Endpoint URL — enter the email provider URL to retrieve the access token.
- Client ID — enter the registered client ID of the application.
- Client Secret — enter the registered client secret of the application.
- (Optional) Scope — enter the scope of the access token, as defined in RFC 6749. Some email providers require the scope to be set. For example, use
https://outlook.office365.com/.defaultif you’ve selected Office365 for the Email Service parameter. Refer to your email provider’s documentation to find the correct scope. - User — enter the email address from which the email is sent.
- Click Create.
Attachments
Attachments
By default, the No Attachment option is selected.
Result Storage & Error Handling
Result Storage & Error Handling
Stop on Error
If switched on, the flow execution will halt in case the mail-sending fails.Advanced
Advanced
Example
This example shows how to configure OAuth2 Client Credentials with Microsoft 365 SMTP using Microsoft Entra ID.Prerequisites
Prerequisites
Before starting, ensure the following:
- Your Microsoft Entra account must have one of the following roles:
- Application Developer (minimum).
- Cloud Application Administrator or Global Administrator (recommended).
- The mailbox that will send emails must:
- Be hosted in Microsoft 365 or Exchange Online.
- Have SMTP AUTH activated.
Create a Multi-Tenant Application in Microsoft Entra ID
Create a Multi-Tenant Application in Microsoft Entra ID
- Log in to the Microsoft Entra admin center.
- In the left sidebar, select Entra ID > App registrations.
-
Click New registration. On the Register an application page, enter a name, for example,
Cognigy SMTP Integration. - In the Supported account types section, select Accounts in any organizational directory (Any Azure AD directory - Multitenant). Follow Microsoft best practices for multitenant applications, especially regarding security and permission scope.
- Leave Redirect URI empty, this field isn’t required for OAuth2 Client Credentials. Click Register.
-
After the registration, the Application Overview page appears. Copy and securely store:
- Application (client) ID.
- Directory (tenant) ID.
Create a Client Secret
Create a Client Secret
- In the created application, go to Manage > Certificates & secrets.
- Click New client secret.
- Enter the required information:
- Description – for example,
Cognigy SMTP Secret. - Expiration – specify the date according to your company’s security policy.
- Click Add. Copy the appeared secret value and store it securely. You will need this secret later for the Send SMTP Email Node.
Configure API Permissions
Configure API Permissions
- Add the SMTP.SendAsApp permission to your Microsoft Entra application. Ensure admin consent is granted where required.
- Register a Service Principal for your application.
Configure the Send SMTP Email Node
Configure the Send SMTP Email Node
- In the Send SMTP Email Node, select Microsoft 365 as the email service.
- For the Authentication Method, select OAuth2 Client Credentials and click + to create a new connection.
- In the connection configuration, fill in the required fields:
- Connection Name — enter a unique name for the connection.
- Client ID — enter the application (Client) ID from Microsoft Entra.
- Client Secret — enter the secret value created under Certificates & Secrets from Microsoft Entra.
- Scope — enter
https://outlook.office365.com/.default - Token Endpoint URL — enter
https://login.microsoftonline.com/{tenant_id}/oauth2/v2.0/tokenand replace{tenant_id}with your Directory (tenant) ID from Microsoft Entra. - User — enter the email address of the sender mailbox. Make sure SMTP AUTH is activated for the user, and the user is granted the
SMTP.SendAsApppermission.
- Click Create to save the connection, then fill in the required fields for the email configuration, such as Recipient TO Email Addresses, Email Subject, and Email Content.
Troubleshooting
Troubleshooting