AI Email Generator with Custom Tone Selection - n8n Workflow

Generate professional emails instantly using this powerful n8n workflow. Select the recipient, context, and tone (formal, friendly, casual) for perfect AI-driven communication using the OpenAI n8n node.

Workflow Preview

Ready to automate?

Download this n8n workflow template and start using it instantly.

Who is this best for?

Business professionals needing high-volume, personalized email drafting.
Customer service teams seeking consistent, tone-appropriate responses.
Users looking for advanced examples of a combined custom n8n node and AI logic.
Anyone interested in creating powerful custom internal tools using n8n templates.

Overview

Writing emails that match the desired tone—whether formal, casual, or friendly—can be time-consuming, especially when managing high volumes of communication. This powerful n8n workflow solves this by providing a simple, user-facing form that handles all the complexity.

By leveraging the LangChain agent and the OpenAI n8n node, this solution transforms raw context and a tone selection into a perfectly formatted, ready-to-send email. This n8n workflow demonstrates how to use custom code within an n8n node to dynamically adjust the AI prompt based on user selection, ensuring highly tailored output every time. It’s one of the most practical n8n templates for accelerating internal communications.

How it Works

This automation starts with an accessible public form and ends by displaying the generated email back to the user.


  1. Trigger & Input: The process begins with the "Email Generator Form" n8n trigger node. The user inputs the recipient name, subject, context (the core message), and selects a desired Tone (Professional, Friendly, Formal, or Casual).

  2. Data Preparation: The "Extract Form Data" n8n node organizes the user inputs into clearly named variables.

  3. Dynamic Prompt Construction: The key logic resides in the "Build AI Prompt" custom n8n node (Code node). This code uses a switch statement to translate the selected tone into highly specific instructions for the AI (e.g., 'Use a highly formal, diplomatic tone'). It then compiles a complete, detailed prompt.

  4. AI Generation: The "Generate Email" n8n node (LangChain Agent), powered by the "OpenAI Chat Model" (using GPT-3.5-Turbo), executes the prompt and produces the raw email body.

  5. Output Display: The generated email is then passed through the "Format Output" n8n node, which re-attaches the original subject and recipient details. Finally, the "Display Generated Email" n8n node uses the Form Completion feature to instantly show the user the finished, copy-paste ready email, concluding the n8n workflow execution.

Installation Guide

To deploy this useful n8n workflow, follow these steps:


  1. Import: Copy the provided JSON data and paste it into your n8n instance using the 'New' menu and selecting 'Import from JSON'.

  2. OpenAI Credentials: Locate the 'OpenAI Chat Model' n8n node. You will need to set up or select an existing OpenAI API key credential.

Click on 'Credentials' and select 'Create New' if necessary.
Input your API key (available from the OpenAI platform).

  1. Customize (Optional): Review the 'Build AI Prompt' n8n node (Code node) if you wish to modify the specific tone instructions or add new tone options to the logic.

  2. Activate: Save the n8n workflow and toggle the 'Active' switch to enable the 'Email Generator Form' n8n trigger.

  3. Usage: Copy the unique URL provided by the 'Email Generator Form' n8n trigger and share it with your users to start generating emails.

Node Details

Email Generator Form (Form Trigger): The initiating n8n trigger. It collects four inputs: Recipient Name, Email Subject, Email Context (textarea), and Tone (dropdown with Professional, Friendly, Formal, Casual options).
Extract Form Data (Set n8n node): Standard node used to cleanly map the form output objects into simple variables (recipient, subject, context, tone) for easier downstream manipulation in the n8n workflow.
Build AI Prompt (Code n8n node): A critical custom n8n node that uses JavaScript logic to create precise tone-specific instructions. This dynamic prompt creation ensures the AI adheres strictly to the user’s selection.
OpenAI Chat Model (LangChain Node): Configures the connection to the OpenAI API, specifying the gpt-3.5-turbo model with a temperature of 0.7 for balanced creativity and consistency.
Generate Email (LangChain Agent n8n node): The core intelligence step. It uses the input prompt to interface with the OpenAI model and produce the final, coherent email text (output).
Display Generated Email (Form Completion n8n node): This n8n node is the final display step, formatting the AI-generated email body along with the original metadata (Subject, Recipient, Tone) in an easy-to-read completion message.

Related n8n Workflows

Free

Nodes: 7 Nodes
Updated: December 26 2025
View all
Created by

Automating your biz, one workflow at a time. I build and share powerful n8n workflows to save you hours and boost productivity. All workflows are completely free. Streamline your operations with no-code.

Featured*