SMTP/IMAP Email Integration for Email Assistants #8207

Closed
opened 2026-02-21 18:24:29 -05:00 by yindo · 3 comments
Owner

Originally created by @fzozyurt on GitHub (Feb 12, 2025).

Self Checks

  • I have searched for existing issues search for existing issues, including closed ones.
  • I confirm that I am using English to submit this report (我已阅读并同意 Language Policy).
  • [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:)
  • Please do not modify this template :) and fill in all the required fields.

1. Is this request related to a challenge you're experiencing? Tell me about your story.

This feature introduces robust email integration capabilities to DifyAI through SMTP and IMAP protocols, specifically designed to empower the creation and direct utilization of email assistants. By incorporating IMAP, DifyAI can connect to email inboxes, monitor for new messages, and trigger workflows based on incoming email content. Simultaneously, SMTP integration enables DifyAI to send emails, allowing for automated responses, notifications, and proactive communication as part of its workflows. This combined functionality unlocks the potential to build sophisticated email assistants directly within DifyAI.

Why is it Beneficial?

  • Creation of Intelligent Email Assistants: This feature directly enables the development of email assistants that can automatically read, understand, and respond to emails. These assistants can be used for various purposes, from customer service and support to personal productivity and task management.
  • Automated Email Workflows: Automate email-related tasks within DifyAI workflows. This includes automatically responding to inquiries, forwarding emails based on content, summarizing email threads, and triggering actions in other systems based on email triggers.
  • Directly Usable Email Assistants: Once configured, these email assistants are directly usable. Users can interact with them by simply sending emails to the designated inbox, and DifyAI will automatically process the emails and execute the defined assistant workflows. No need for complex API integrations or intermediary steps.
  • Enhanced Customer Communication: Improve customer service and communication by building email assistants that can handle common inquiries, provide support, and route complex issues to human agents efficiently and promptly, all via email.
  • Increased Productivity and Efficiency: Automate repetitive email tasks, freeing up human agents and employees to focus on more complex and strategic work. Email assistants can handle routine inquiries, schedule meetings, and manage email organization automatically.

2. Additional context or comments

How it Works (Basic Level):

SMTP/IMAP Configuration: Within DifyAI, users configure their SMTP and IMAP server settings, including server addresses, ports, usernames, and passwords for the email account to be integrated.

IMAP Listener (Email Monitoring): DifyAI sets up an IMAP listener to continuously monitor the configured email inbox for new messages.

Email Trigger (Incoming Email): When a new email arrives in the inbox, it acts as a trigger, initiating a pre-defined DifyAI workflow.

Email Content Processing: DifyAI processes the content of the incoming email – including subject, body, sender, and attachments – and makes this data available as input for the workflow.

SMTP Action (Sending Emails): Within workflows, an SMTP action can be added to send emails. This action can be configured to dynamically generate email content based on workflow logic and data, and send emails to specified recipients.

Email Assistant Workflow Execution: The triggered workflow, designed as an email assistant, executes based on the incoming email, potentially sending automated responses, updating databases, triggering other integrations, and more, all through email communication

3. Can you help us with this feature?

  • I am interested in contributing to this feature.
Originally created by @fzozyurt on GitHub (Feb 12, 2025). ### Self Checks - [x] I have searched for existing issues [search for existing issues](https://github.com/langgenius/dify/issues), including closed ones. - [x] I confirm that I am using English to submit this report (我已阅读并同意 [Language Policy](https://github.com/langgenius/dify/issues/1542)). - [x] [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:) - [x] Please do not modify this template :) and fill in all the required fields. ### 1. Is this request related to a challenge you're experiencing? Tell me about your story. This feature introduces robust email integration capabilities to DifyAI through SMTP and IMAP protocols, specifically designed to empower the creation and direct utilization of email assistants. By incorporating IMAP, DifyAI can connect to email inboxes, monitor for new messages, and trigger workflows based on incoming email content. Simultaneously, SMTP integration enables DifyAI to send emails, allowing for automated responses, notifications, and proactive communication as part of its workflows. This combined functionality unlocks the potential to build sophisticated email assistants directly within DifyAI. Why is it Beneficial? - Creation of Intelligent Email Assistants: This feature directly enables the development of email assistants that can automatically read, understand, and respond to emails. These assistants can be used for various purposes, from customer service and support to personal productivity and task management. - Automated Email Workflows: Automate email-related tasks within DifyAI workflows. This includes automatically responding to inquiries, forwarding emails based on content, summarizing email threads, and triggering actions in other systems based on email triggers. - Directly Usable Email Assistants: Once configured, these email assistants are directly usable. Users can interact with them by simply sending emails to the designated inbox, and DifyAI will automatically process the emails and execute the defined assistant workflows. No need for complex API integrations or intermediary steps. - Enhanced Customer Communication: Improve customer service and communication by building email assistants that can handle common inquiries, provide support, and route complex issues to human agents efficiently and promptly, all via email. - Increased Productivity and Efficiency: Automate repetitive email tasks, freeing up human agents and employees to focus on more complex and strategic work. Email assistants can handle routine inquiries, schedule meetings, and manage email organization automatically. ### 2. Additional context or comments How it Works (Basic Level): SMTP/IMAP Configuration: Within DifyAI, users configure their SMTP and IMAP server settings, including server addresses, ports, usernames, and passwords for the email account to be integrated. IMAP Listener (Email Monitoring): DifyAI sets up an IMAP listener to continuously monitor the configured email inbox for new messages. Email Trigger (Incoming Email): When a new email arrives in the inbox, it acts as a trigger, initiating a pre-defined DifyAI workflow. Email Content Processing: DifyAI processes the content of the incoming email – including subject, body, sender, and attachments – and makes this data available as input for the workflow. SMTP Action (Sending Emails): Within workflows, an SMTP action can be added to send emails. This action can be configured to dynamically generate email content based on workflow logic and data, and send emails to specified recipients. Email Assistant Workflow Execution: The triggered workflow, designed as an email assistant, executes based on the incoming email, potentially sending automated responses, updating databases, triggering other integrations, and more, all through email communication ### 3. Can you help us with this feature? - [ ] I am interested in contributing to this feature.
yindo added the 💪 enhancement label 2026-02-21 18:24:29 -05:00
yindo closed this issue 2026-02-21 18:24:29 -05:00
Author
Owner

@crazywoola commented on GitHub (Feb 12, 2025):

We do have SMTP email tool now, however we do not have a trigger function yet. It might come along with the 1.0.0.

@crazywoola commented on GitHub (Feb 12, 2025): We do have SMTP email tool now, however we do not have a trigger function yet. It might come along with the 1.0.0.
Author
Owner

@fzozyurt commented on GitHub (Feb 13, 2025):

We do have SMTP email tool now, however we do not have a trigger function yet. It might come along with the 1.0.0.

@crazywoola At the moment, if you convey from which file the flow triggering process is done with the API, I think I can contribute to the project by providing review and development. Do you have any information about this?

@fzozyurt commented on GitHub (Feb 13, 2025): > We do have SMTP email tool now, however we do not have a trigger function yet. It might come along with the 1.0.0. @crazywoola At the moment, if you convey from which file the flow triggering process is done with the API, I think I can contribute to the project by providing review and development. Do you have any information about this?
Author
Owner

@crazywoola commented on GitHub (Feb 13, 2025):

We do have SMTP email tool now, however we do not have a trigger function yet. It might come along with the 1.0.0.

@crazywoola At the moment, if you convey from which file the flow triggering process is done with the API, I think I can contribute to the project by providing review and development. Do you have any information about this?

I read your previous issue, the problem is we use redis and celery for async tasks, however it's not like the message queue you though it was.

For example https://github.com/langgenius/dify/blob/56e15d09a9e94de963dd5fc38c7455a7aaee99f3/api/tasks/mail_invite_member_task.py

One way to to is, you need some github actions like or other MQ which can receive the email, and use the API(/chat-messages or workflow/run) we provided to receive the parameters and run the workflow.

@crazywoola commented on GitHub (Feb 13, 2025): > > We do have SMTP email tool now, however we do not have a trigger function yet. It might come along with the 1.0.0. > > [@crazywoola](https://github.com/crazywoola) At the moment, if you convey from which file the flow triggering process is done with the API, I think I can contribute to the project by providing review and development. Do you have any information about this? I read your previous issue, the problem is we use redis and celery for async tasks, however it's not like the message queue you though it was. For example https://github.com/langgenius/dify/blob/56e15d09a9e94de963dd5fc38c7455a7aaee99f3/api/tasks/mail_invite_member_task.py One way to to is, you need some github actions like or other MQ which can receive the email, and use the API(`/chat-messages` or `workflow/run`) we provided to receive the parameters and run the workflow.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#8207