> For the complete documentation index, see [llms.txt](https://docs.diaflow.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.diaflow.io/workflow-builder/nodes/built-in-tools/smtp.md).

# SMTP

## SMTP

### What does it do?

The **SMTP** node sends emails from your own mail account inside a workflow. Think of it like an automated office mail desk that takes your message, adds recipients and files, then sends everything for you.

It works well for alerts, invoices, approvals, and customer follow-ups.

#### Smart features

* **Uses your saved email connection**: select one SMTP resource and Diaflow sends from that mailbox.
* **Supports dynamic fields**: you can pull the **To**, **Cc**, **Subject**, **Message**, and **Attachments** from earlier steps.
* **Handles multiple recipients**: send to one person or several people in **To** and **Cc**.
* **Adds file attachments automatically**: attach files created or stored earlier in the workflow.
* **Chooses the secure connection for you**: Diaflow uses the right mail security method based on the port in your SMTP resource.
* **Prevents accidental mail loops**: if a workflow starts from an incoming email, Diaflow blocks sending back to that same triggering address.
* **Avoids duplicate sends for one hour**: if the same node runs again with the same content, Diaflow can return the earlier success instead of sending a duplicate email.

<figure><img src="/files/RTM9WBecGni2SNQn5fx6" alt=""><figcaption></figcaption></figure>

### Real-World Business Value

* Send invoices with PDF attachments to customers as soon as a deal is marked closed.
* Notify a manager and support team when a high-priority request enters the workflow.
* Deliver automated status updates, summaries, or approval emails without manual copy and paste.

### Add Gmail SMTP credentials

Use these steps if you want to send email with a Google account.

{% hint style="warning" %}
Google SMTP usually requires an **App password**. Turn on **2-Step Verification** in your Google Account before you create one.
{% endhint %}

{% stepper %}
{% step %}

### Open Add Credentials

* In the SMTP node, open **Credentials**.
* Click **Add Credentials**.
* Keep the credentials form open.
* You will paste the Google app password here later.

<figure><img src="/files/vY7iDTTYwbFFtTLIKl4z" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}

### Enter the SMTP details

* In **Host**, enter `smtp.gmail.com`.
* In **Port**, enter `465`.
* In **Username**, enter your full Google email address.
* If the form includes a sender field, enter the same email address in **From email**.
* Leave **Password** empty for now.

<figure><img src="/files/9SYa9pzkce2p4HPA7Gli" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}

### Open Manage your Google Account

* Open Gmail or another Google page.
* Click your profile picture.
* Click **Manage your Google Account**.

<figure><img src="/files/oHfbQHnfWK6cXWSFDRy9" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}

### Search for App Password

* Use the Google Account search bar.
* Search for `App Passwords`.
* Open the **App passwords** result.
* Verify your identity if Google asks.

<figure><img src="/files/ehX2bhVDP3TMV323bP3t" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/mLvkWH6aZpZZsVpwaJQI" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}

### Create Password

* In **App passwords**, enter the app name you want to use.
* Click **Create**.
* Copy the generated password before you close the window.

<figure><img src="/files/eGjcVyR64uBCaRGFnbDT" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}

### Paste the password into Add Credentials

* Return to the **Add Credentials** page in Diaflow.
* Paste the generated app password into **Password**.
* Save the credential.
* Select that saved credential in the SMTP node.

<figure><img src="/files/WcNLNLI7Ij5UD6zzmCYu" alt=""><figcaption></figcaption></figure>
{% endstep %}
{% endstepper %}

### Use the credential in the SMTP node

* In **Credentials**, select the Gmail SMTP credential you just saved.
* In **To**, enter one email address or insert one or more addresses from a previous node.
* In **Cc**, add any extra recipients who should receive a copy.
* In **Object**, enter the email subject line.
* In **Message**, write the email content you want recipients to receive.
* In **Attachments**, select any files you want to include, such as a generated invoice or exported report.
* Run the workflow and confirm the send result in the **Output** tab.

### The Transformation: Before & After

**Before workflow data ready to send**

<figure><img src="/files/3iczldLXKCeuZESZ0JbO" alt=""><figcaption></figcaption></figure>

**After email sent**

<figure><img src="/files/FrfjBrhe5n1x64WZM1oe" alt=""><figcaption></figcaption></figure>

### Tips & Warnings for First-Timers

#### Best practices

* Use a tested SMTP resource before building the rest of the workflow.
* Enter full email addresses in **To** and **Cc**.
* Use standard list formatting if you pass multiple recipients from another step.
* Keep attachment filenames clear before sending. Recipients may see the exact file name.
* Use this node for final send steps, after you confirm the message content is correct.

#### Warnings

* Do not select an old, inactive, or wrong SMTP resource. The node will try to use the resource you choose.
* Do not expect the same email to send again within one hour if all settings and content are unchanged. Diaflow may treat it as a duplicate.
* Do not paste recipient lists in unusual text formats. If you pass multiple addresses, keep them in a clean standard list format.
* Do not include the triggering sender in **To** or **Cc** when the workflow starts from an incoming email. The send will be blocked.
* Do not leave the SMTP host, port, username, or password incorrect in the selected resource. The email will fail to send.
* Do not attach files that no longer exist or cannot be reached by the workflow.
* Do not rely on this node for instant failure feedback when the mail server is slow or unreachable. Sending can take longer than expected.
* Do not use vague attachment names if the recipient needs to recognize the file quickly.

### Need help?

* Learn the basics in [How a node works](/getting-started/lets-start-with-the-basics/how-a-node-works.md)
* Build the full flow in [Create a workflow](/workflow-builder/create-a-workflow.md)
* Browse related nodes in [Component List](/workflow-builder/component-list.md)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.diaflow.io/workflow-builder/nodes/built-in-tools/smtp.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
