Send Gmail with Aliases and Multiple Attachments
detail.loadingPreview
This n8n workflow provides a robust solution for sending highly customized emails via the Gmail API, including the ability to send from verified aliases and attach multiple files. It handles complex MIME message construction and base64url encoding, ensuring seamless integration with your Gmail account.
About This Workflow
Streamline your email communications with this powerful n8n workflow designed for advanced Gmail integration. It intelligently processes incoming data, validates essential fields like sender, recipient, subject, and HTML body, then dynamically constructs a multipart MIME email message. A standout feature is its comprehensive attachment handling, allowing you to include multiple files by automatically detecting binary data from preceding nodes. The workflow also supports sending emails from any verified alias associated with your Gmail account. Finally, it meticulously encodes the entire message in base64url format, ready for direct consumption by the Gmail API, ensuring reliable and flexible email delivery through your existing Gmail infrastructure.
Key Features
- Send from Gmail Aliases: Utilize any verified email address associated with your Gmail account as the sender for flexible branding and communication.
- Multi-Attachment Support: Seamlessly include multiple files as attachments, automatically processing binary data from previous workflow steps.
- Custom HTML Email Bodies: Craft rich, dynamic email content using full HTML, including a special
{{FILE_COUNT}}placeholder for attachment summaries. - Robust Input Validation: Ensures all required email fields (
fromEmail,toEmail,subject,htmlBody) are present before attempting to send. - Direct Gmail API Integration: Leverages the official Gmail API for reliable email delivery, complete with OAuth2 authentication.
How To Use
- Prepare Input Data: Ensure the node preceding
Format Email Payloadoutputs an item withfromEmail,toEmail,subject, andhtmlBodyin its JSON body. Optional fields includesenderNameandreplyTo. For attachments, make sure binary data is passed from a previous node (e.g., Read Binary File, HTTP Request with file download). - Configure Gmail OAuth2 Credential: In your n8n instance, set up a new Gmail OAuth2 credential. This will link n8n to your Google account, allowing it to send emails on your behalf.
- Connect Nodes: Ensure the
Format Email Payloadnode is connected to theSend Gmail as AliasHTTP Request node. The HTTP Request node will automatically pick up theencoded_messageoutput from the Code node. - Customize HTML Body: Optionally, include
{{FILE_COUNT}}in yourhtmlBodyinput to dynamically display the number of attachments in the email content. - Test and Deploy: Run the workflow with sample data to verify correct email sending and attachment handling.
Apps Used
Workflow JSON
{
"id": "74b321f7-7c7a-4549-96f2-cd49d64d5d41",
"name": "Send Gmail with Aliases and Multiple Attachments",
"nodes": 23,
"category": "Operations",
"status": "active",
"version": "1.0.0"
}Note: This is a sample preview. The full workflow JSON contains node configurations, credentials placeholders, and execution logic.
Get This Workflow
ID: 74b321f7-7c7a...
About the Author
DevOps_Master_X
Infrastructure Expert
Specializing in CI/CD pipelines, Docker, and Kubernetes automations.
Statistics
Related Workflows
Discover more workflows you might like
Automate Getty Images Editorial Search & CMS Integration
This n8n workflow automates searching for editorial images on Getty Images, extracts key details and embed codes, and prepares them for seamless integration into your Content Management System (CMS), streamlining your content creation process.
Instant WooCommerce Order Notifications via Telegram
When a new order is placed on your WooCommerce store, instantly receive detailed notifications directly to your Telegram chat. Stay on top of your e-commerce operations with real-time alerts, including order specifics and a direct link to view the order.
On-Demand Microsoft SQL Query Execution
This workflow allows you to manually trigger and execute any SQL query against your Microsoft SQL Server database. Perfect for ad-hoc data lookups, administrative tasks, or quick tests, giving you direct control over your database operations.