Skip to content

SMTP/IMAP Email

The SMTP/IMAP Email component in Nappai allows you to automate the management of your email communications. It acts as a bridge between your automation workflows and your email account, enabling you to send notifications, alerts, or reports, as well as read and process incoming messages. Whether you need to send a confirmation email to a client or analyze emails received in your inbox for data processing, this component handles the connection and data exchange securely.

How it Works

This component uses two standard internet protocols to handle different types of tasks:

  1. Sending Emails (SMTP): When you use the component to send emails, it connects to your email provider’s outgoing mail server. It takes the details you provide—such as the recipient’s address, subject, and message body—and securely delivers the email to the destination.
  2. Reading Emails (IMAP): When you need to retrieve messages, the component connects to your mailbox via the IMAP protocol. It can search your inbox (or specific folders) for recent emails, download them, and even extract text from attachments (like PDFs or Word documents) if you enable the relevant settings.

By selecting the appropriate Operation, you tell the component whether to act as a sender, a reader, or an intelligent processor that handles attachments.

Connection & Credentials

This component requires configuring a credential in the Nappai panel before interacting with the external service:

  1. Go to the Credentials section in your Nappai panel.
  2. Create a new credential of the type SMTP / IMAP and fill in the required fields:
    • SMTP Host: The address of your outgoing mail server.
    • SMTP Port: The port number for outgoing connections.
    • IMAP Host: The address of your incoming mail server.
    • IMAP Port: The port number for incoming connections.
    • Username: Your email address or login ID.
    • Password: Your email password or app-specific password.
  3. In your workflow, select the saved credential in the Credential input field of this node.

Inputs

The following fields are available to configure this component. Each field may be visible in different operations:

  • Operation: A dropdown menu that determines how the component behaves (e.g., send an email, fetch emails, or process attachments).
  • Recipient(s): Enter the email address of the person receiving the message. For multiple recipients, separate addresses with commas.
  • Subject: The title or subject line of the email you are sending.
  • Body: The main text content of the email message.
  • Attachments: Files to attach to the email. You must connect a file handle from a previous component here.
  • Limit: The number of recent emails to fetch from your inbox.
  • Folder: The name of the IMAP folder to check for emails (e.g., “INBOX”).
  • Search Criteria: Select criteria to filter emails, such as searching by specific keywords or dates.
  • Fetch Attachments: If enabled, the component will download attachments found in the emails. If disabled, attachments are ignored.
  • Process Attachments: Requires ‘Fetch Attachments’ to be enabled. If enabled, the component extracts text content from supported attachments (like PDF or DOCX files).
  • Enable OCR: Requires both ‘Fetch Attachments’ and ‘Process Attachments’ to be enabled. If enabled, the component uses Optical Character Recognition (OCR) to extract text from image files (PNG, JPG).
  • Mark as Read: If enabled, fetched emails will be marked as “read” in your inbox.

Outputs

  • Data: This output contains the result of the operation.
    • For sending, it typically confirms success or provides an ID of the sent message.
    • For reading/fetching, it returns a list of email details, including the subject, sender, date, and body text. If attachments were processed, the extracted text is included here.

Output Data Example (JSON)json

{ “status”: “success”, “message”: “Email sent successfully”, “data”: { “email_id”: “12345”, “subject”: “Project Update”, “sender”: “client@example.com”, “body”: “Here are the latest updates…”, “attachments”: [ { “filename”: “report.pdf”, “extracted_text”: “Revenue increased by 10%…” } ] } }

Connectivity

This component is typically used in the following ways within a workflow:

  • Outgoing: It connects to the output of components that generate text (like a LLM chatbot or a database query) to populate the Subject and Body fields for sending.
  • Incoming: It connects its Data output to components that need to analyze email content, such as data parsers, summarizers, or AI assistants that act on the email’s instructions.
  • File Handling: When sending emails with attachments, it connects to the output of file storage or download components via the Attachments field.

Usage Example

Scenario: Automated Customer Support Response

  1. Fetch: Use the SMTP/IMAP Email component in “Fetch Emails” mode to read unread customer inquiries from your INBOX.
  2. Process: Enable Fetch Attachments and Process Attachments if customers often send supporting documents.
  3. Analyze: Connect the Data output to an AI component to summarize the inquiry.
  4. Respond: Connect the AI’s response to the SMTP/IMAP Email component in “Send Email” mode, using the original sender’s address as the Recipient(s) and the AI summary as the Body.

Tips and Best Practices

  • Security: Always use app-specific passwords instead of your main account password if your provider supports it, to enhance security.
  • Efficiency: Set the Limit field to a reasonable number to avoid processing thousands of emails at once, which can slow down your workflow.
  • Attachments: Remember that processing attachments requires more computational power. Only enable Process Attachments and Enable OCR if you actually need to read the content of the files.
  • Mark as Read: Use the Mark as Read option carefully. If you are analyzing emails for a database, you might want to leave them unread so you can process them later without duplication.

Security Considerations

  • Credential Safety: Never share your credential information. Ensure that the SMTP/IMAP credentials stored in Nappai are protected by appropriate access controls.
  • Port Usage: Ensure you are using secure ports (like 465 or 587 for SMTP, and 993 for IMAP) if your email provider supports it, to encrypt the data in transit.
  • Data Privacy: Be cautious when downloading and processing attachments, especially if they contain sensitive personal or financial data. Ensure your workflow complies with relevant data protection regulations.