Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Frappe Mail Connector #26797

Merged
merged 14 commits into from
Jul 11, 2024
Merged

Conversation

s-aga-r
Copy link
Contributor

@s-aga-r s-aga-r commented Jun 19, 2024

Integrates Frappe Mail with the Email Account DocType, enabling seamless sending and receiving of emails via the Frappe Mail API.

  • Connect to Frappe Mail

    • Basic (API Key and Secret)

      basic.auth.mp4
    • OAuth

      oauth.mp4
  • Validate on Save

    When saving the Email Account, the API credentials and mailbox (for inbound and outbound emails) are validated with the Frappe Mail site.

    image

  • Outbound

    The framework's Email Queue sends an HTTP request to the Frappe Mail API (outbound/send) with a JSON object containing the sender, recipient(s), and raw message. Frappe Mail parses the raw message, signs it with the mailbox domain's DKIM signature, and pushes it to an agent for delivery.

    image

  • Inbound

    Inbound email handling varies based on the protocol:

    • POP: The pulled email is removed to prevent duplicate pulls.
    • IMAP: Unique Identifiers (UIDs) ensure only new emails are pulled. The maximum UID is maintained in the system and updated with each pull.

    Frappe Mail uses Mail Sync History to keep track of pulled emails, ensuring that each pull retrieves the next set of emails.

    • Handling Multiple Sites/Devices
      The Mail Sync History includes a Source field to differentiate between devices. When making a pull request to Frappe Mail, an X-Site header can be passed to identify the requesting device or source. The default source is the request IP if the X-Site header is not provided.

    • Failed while parsing/processing the raw message
      The EmailAccount.last_synced_at timestamp is passed when requesting emails from Frappe Mail. This timestamp is only updated when the pull request is completed, ensuring no emails are skipped.

@github-actions github-actions bot added the add-test-cases Add test case to validate fix or enhancement label Jun 19, 2024
@s-aga-r s-aga-r marked this pull request as ready for review June 20, 2024 07:33
@s-aga-r s-aga-r marked this pull request as draft June 20, 2024 10:01
@s-aga-r s-aga-r marked this pull request as ready for review June 21, 2024 07:42
@surajshetty3416 surajshetty3416 self-assigned this Jun 21, 2024
@s-aga-r s-aga-r marked this pull request as draft June 22, 2024 02:36
@s-aga-r s-aga-r marked this pull request as ready for review June 27, 2024 11:41
@surajshetty3416 surajshetty3416 merged commit acd41b2 into frappe:develop Jul 11, 2024
22 of 24 checks passed
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 26, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
add-test-cases Add test case to validate fix or enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants