TechBuzzPro

How to Send an Email in n8n Using the Gmail Node

· 6 min read · Apps & Browsers

In this article
  1. What You'll Need
  2. Step-by-Step
  3. Common Mistakes
  4. Tips
  5. Troubleshooting
  6. Frequently Asked Questions

To send an email in n8n using the Gmail node, add a Gmail node to your workflow, connect your Google account via OAuth2, set the Resource to Message and Operation to Send, then fill in the recipient, subject and body. This guide walks through the exact steps, plus the common mistakes and fixes.

What You'll Need

  • An n8n instance (cloud or self-hosted) with workflow editing access.
  • A Google account with Gmail enabled.
  • Permission to create OAuth2 credentials in the Google Cloud Console (or an admin who can do it for you).
  • Basic familiarity with the n8n editor: adding nodes, connecting them, and executing a workflow.

Step-by-Step

  1. Open or create a workflow. In the n8n editor, click New Workflow or open an existing one. You need at least a trigger node (for example, a Manual Trigger or a Schedule Trigger) so you can test the email step.
  2. Add the Gmail node. Click the + button, search for Gmail, and select it. Place it after your trigger or after the node that produces the data you want to email.
  3. Create Gmail credentials. In the Gmail node panel, open the Credential dropdown and choose Create New. n8n will show fields for Client ID and Client Secret. You get these from the Google Cloud Console:
    • Create a project (or select an existing one).
    • Enable the Gmail API for that project.
    • Configure the OAuth consent screen. For testing, add your own Google account as a test user.
    • Create OAuth 2.0 Client ID credentials of type Web application.
    • In Authorized redirect URIs, paste the OAuth callback URL shown in n8n (it looks like https://your-n8n-domain/rest/oauth2-credential/callback).
    • Copy the Client ID and Client Secret back into n8n.
  4. Connect your Google account. Click Sign in with Google in the credential window, choose the Gmail account you want to send from, and approve the requested scopes. When you return to n8n, the credential should show as connected.
  5. Set the node parameters. In the Gmail node:
    • Resource: Message
    • Operation: Send
    • To: the recipient's email address. You can type it or map it from incoming data using an expression.
    • Subject: your subject line.
    • Email Type: choose Text or HTML depending on your body content.
    • Message: the body of the email.
  6. Add optional fields if needed. Expand Additional Fields to set CC, BCC, Reply-To, attachments or a custom From name. Attachments can be binary data from a previous node or a file path.
  7. Test the node. Click Execute Node. n8n will run the Gmail node and show the output, including the message ID and thread ID if successful. Check the recipient inbox to confirm delivery.
  8. Activate the workflow. Once the test passes, toggle the workflow to Active so it runs on its trigger. For manual-only workflows, save and run as needed.

Common Mistakes

  • Wrong redirect URI. The URI in Google Cloud must match the one n8n displays exactly, including https and any port. A mismatch causes an authentication error.
  • Gmail API not enabled. Creating OAuth credentials without enabling the Gmail API leads to permission errors when the node tries to send.
  • Using the wrong operation. The Gmail node has separate operations for sending, replying, getting and deleting. Selecting Get instead of Send is a common slip.
  • Forgetting to map dynamic fields. If you type a literal email address where you meant to use an expression, every run sends to the same address. Use the expression editor to pull values from previous nodes.
  • HTML body sent as plain text. If you write HTML but leave Email Type as Text, recipients see raw tags. Switch to HTML for formatted content.
  • Testing with an unverified app. In Google Cloud, if the OAuth consent screen is in testing mode, only added test users can authorize. Add the sending account as a test user.

Tips

  • Use a dedicated Gmail account or Google Workspace account for automation to keep sent mail separate from personal correspondence.
  • Store the body in a Set node or a template so you can reuse the same layout across multiple Gmail nodes.
  • Add an IF node before the Gmail node to skip sending when required fields are empty, avoiding failed executions.
  • For high-volume sending, check Google's sending limits for your account type and consider batching or using a transactional email service instead.
  • Keep credential names descriptive (for example, Gmail – Support Inbox) so you can tell multiple Gmail connections apart.

Troubleshooting

If the node fails, work through these checks in order:

  1. Re-run the node and read the error message. n8n shows the HTTP status and Google's error text. 401 Unauthorized usually means the credential expired or was revoked; reconnect it. 403 Forbidden often means the Gmail API is disabled or the account lacks permission.
  2. Reconnect the credential. Open the credential, click Reconnect, and sign in again. This refreshes the token without recreating the client.
  3. Verify the redirect URI. Compare the URI in Google Cloud with the one in n8n character by character. Update Google Cloud if they differ, then reconnect.
  4. Check the OAuth consent screen status. If the app is in testing, confirm your sending account is listed as a test user. If the app is published, confirm the scopes include Gmail send access.
  5. Confirm the Gmail API is enabled for the correct project in Google Cloud. Enabling it in a different project than the one holding your credentials will not help.
  6. Test with a minimal email. Send a plain-text message to your own address with no attachments or CC. If that works, the issue is in the extra fields or the body content.
  7. Check n8n's execution log for the exact request and response. If you self-host n8n, confirm the instance can reach Google's servers and that your reverse proxy forwards the callback path correctly.

Frequently Asked Questions

Can I send email from a different Gmail address than the one I authorized?

Yes, if the authorized account has permission to send as that address (for example, an alias or a delegated mailbox in Google Workspace). Set the From field in Additional Fields. Otherwise, the email is sent from the authorized account.

Do I need to enable the Gmail API in Google Cloud?

Yes. The Gmail node uses the Gmail API, so it must be enabled for the project that holds your OAuth credentials. Without it, authentication may succeed but sending will fail.

Why does the node say the credential is not connected?

This usually means the OAuth token was revoked, expired, or the redirect URI changed. Open the credential and reconnect. If it still fails, recreate the OAuth client in Google Cloud and paste the new Client ID and Secret into n8n.

Can I send HTML emails with the Gmail node?

Yes. Set Email Type to HTML and provide the HTML markup in the Message field. Keep the markup simple and test with a real inbox, since some email clients strip certain styles.

How do I attach a file?

In Additional Fields, add an attachment and point it to binary data from a previous node (for example, a file downloaded by an HTTP Request node) or provide a file path if n8n has access to it. The field expects the binary property name, not a URL.

Does the Gmail node work with Google Workspace accounts?

Yes, provided your Workspace administrator allows the Gmail API and third-party OAuth apps. If your organization restricts app access, you may need an admin to approve the OAuth client before you can connect.