n8n workflow template · 19 nodes · Gmail
Analyze & Sort Suspicious Email Contents with ChatGPT is a free n8n workflow template that starts from the Gmail Trigger node and works with Gmail, Microsoft Outlook, OpenAI and Jira Software. It has 19 nodes, 1 of them AI nodes (OpenAI). The notes inside the workflow say: “This section of the workflow connects to a Gmail account using the Gmail Trigger node, capturing incoming emails in real-time, with checks performed every minute.” To run it, you add your own credentials for Gmail OAuth2, HTTP Basic Auth, Jira Software Cloud API, Microsoft Outlook OAuth2 and OpenAI API.
The text below comes from the sticky notes inside the workflow. We removed links, code samples and anything that looks like a key or token.
This section of the workflow connects to a Gmail account using the Gmail Trigger node, capturing incoming emails in real-time, with checks performed every minute. Once an email is detected, its key components—such as the subject, recipient, body, and headers—are extracted and assigned to variables using the Set Gmail Variables node. These variables are structured for subsequent analysis and processing in later steps.
This section enables the integration of Microsoft Outlook to monitor and capture incoming emails. The Microsoft Outlook Trigger node checks for new messages every minute. Once an email is detected, the Retrieve Headers of Email node fetches detailed header and body content via the Microsoft Graph API. The Format Headers node organizes the email headers into a structured format using a JavaScript function, ensuring clarity and readiness for further processing. Finally, the Set Outlook Variables node extracts and assigns key details—such as the email subject, recipient, body, and formatted headers—to variables for use in subsequent workflow steps. This section is essential for processing Outlook emails and preparing them for analysis and reporting.
This section processes the email body into both text and visual formats for detailed analysis and reporting. The Set Email Variables node organizes the email's data, including its HTML body and text content, to prepare it for further steps. The Convert Email Body to File node creates a.txt file containing the plain text version of the email body, useful for documentation or further analysis.
The Screenshot HTML node sends the email's HTML body to the hcti.io API, generating a screenshot that visually represents the email's layout. The Retrieve Screenshot node then fetches this image, making it available for attachment or review in subsequent steps. This dual-format processing ensures both clarity and flexibility in email analysis workflows.
This section leverages ChatGPT for advanced email content and header analysis to determine potential phishing threats. The Analyze Email with ChatGPT node processes the email's HTML body and headers, generating a detailed JSON response that categorizes the email as malicious or benign. The response includes a verbose explanation, formatted for Jira, outlining the reasons for the classification. The Check if Malicious node evaluates the AI output to determine the next steps based on the email's threat status. If flagged as malicious, subsequent actions like reporting and ticket creation are triggered. This section ensures precise, AI-driven analysis to enhance email security workflows.
This section streamlines the process of logging phishing email reports in Jira, complete with detailed analysis and attachments. The workflow creates two distinct Jira tickets depending on the AI classification of the email
The Set Jira ID node ensures the generated ticket's ID is tracked for subsequent operations. Attachments are handled efficiently
This section enhances reporting by automating ticket creation, ensuring all relevant email data is readily available for review by security teams.
The 19 nodes in file order (sticky notes excluded). Branches and connections determine execution order in n8n:
Configure your own credentials after importing. Create each credential in n8n, then select it in the node.
Do you need somewhere to run it? Read our guide to self-hosted n8n.
We can adapt this workflow to your apps, data and process, then deploy and support it.
Contact Us