Skip to content

Conversation

@artykbasar
Copy link
Contributor

@artykbasar artykbasar commented Dec 31, 2025

Summary

Adds Email Domain support for Custom email accounts in Helpdesk Settings. You can now select an existing Email Domain while creating/editing a Custom account; selecting a domain auto-fills the IMAP/SMTP server, ports, and SSL-related fields. Domain creation/editing is delegated to Desk to avoid duplicating DocType UI inside Helpdesk.

What changed

UI (Helpdesk Settings → Email Accounts)

  • Custom provider now includes an Email Domain Link field.
  • Selecting a domain fetches the Email Domain doc and auto-populates:
    • Incoming/Outgoing servers, ports, SSL flags, cert validation flags, sent folder settings, attachment limit, etc.
  • Create New from the Link field opens Desk in a new tab:
    • /desk/email-domain/new-email-domain
  • Added Edit Domain button (only shown when a domain is selected):
    • /desk/email-domain/<domain>
  • Added “Open in Desk” link for Email Account records in the edit view (convenience + escape hatch).
  • Custom provider icon falls back to the existing Lucide mail icon (no new assets).

Validation

  • For Custom accounts, validation now allows either:
    • Domain selected, OR
    • Manual server settings (email_server + incoming_port + smtp_server + smtp_port)

Backend (helpdesk/api/settings/email.py)

  • Adds service aliases for compatibility with Email Account “service” values, e.g.:
    • Outlook.com, Yahoo Mail, Yandex.Mail (alongside existing labels)

Why

Previously, Custom-domain accounts configured via Desk could result in a broken/blank experience in Helpdesk Settings and were not manageable from the Helpdesk UI. This change makes Custom email accounts configurable in Helpdesk while still leveraging the canonical Desk DocTypes.

Manual testing

  • Create → Custom → select Email Domain → verify fields auto-fill → save.
  • Edit existing Custom account → change Email Domain → verify fields update.
  • Verify Frappe Mail still uses its API Key/Secret/Site flow (not Custom).
  • Verify Create/Edit Domain links open Desk in a new tab.

Issue

Fixes #2635

Helpdesk.custom.email.providermov.-.1080WebShareName.mov

@RitvikSardana
Copy link
Member

@artykbasar
please add some screenshots.

@artykbasar
Copy link
Contributor Author

@artykbasar please add some screenshots.

Helpdesk.custom.email.providermov.-.1080WebShareName.mov

@artykbasar
Copy link
Contributor Author

@RitvikSardana I have done screen recording of the ui changes, I hope it will be easy to see. If you cannot see it, let me know I will upload screenshots as well.

@RitvikSardana
Copy link
Member

Hello @artykbasar

image

Both SSL and TLS settings are available for both Incoming and Outgoing

Would suggest to add SSL and TLS After Incoming Port Field and label it as "Use SSL for Incoming"

similarly add these after "Outgoing" Port as well.

"Use SSL for Outgoing"

import EmailProviderIcon from "./EmailProviderIcon.vue";
import { __ } from "@/translation";
import SettingsLayoutBase from "@/components/layouts/SettingsLayoutBase.vue";
import { Link } from "@/components";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use Link component from frappe-ui

Will not need Clear button then

const { updateOnboardingStep } = useOnboarding("helpdesk");

const state: Reactive<EmailAccount> = reactive({
const state = reactive<EmailAccountFormState>({
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use different state variable instead of using the same for Custom Domains

A lot of unwanted data is sent to the backend in case of Gmail or some Popular Providers.

import SettingsLayoutBase from "@/components/layouts/SettingsLayoutBase.vue";
import { Link } from "@/components";

type EmailAccountFormState = {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use different type which maybe can be extended from this

watch(
() => state.domain,
async (val) => {
if (!val) return;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can add another early return if email account selected is not Custom

</span>
<span v-if="deskEditUrl" class="flex items-center gap-1">
<a :href="deskEditUrl" target="_blank" class="text-ink-blue-2 underline">
{{ __('Open in Desk') }}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://docs.frappe.io/erpnext/user/manual/en/email-domain

this link should be used

Read more about it

"use_ssl": 1,
"smtp_server": "smtp-mail.outlook.com",
},
"Outlook.com": { # backwards-compatible alias
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please explain this with some context of backwards compatibility

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi Ritvik — good question.

I added the Outlook.com / Yahoo Mail / Yandex.Mail entries because those exact strings are already used by Frappe’s Email Account DocType in Desk, and many existing installations can have Email Account records stored with those values in the service field.

In Helpdesk Settings UI we show the providers as Outlook, Yahoo, and Yandex. If someone already has an Email Account created in Desk with service = "Outlook.com" (for example), Helpdesk’s backend lookup (email_service_config.get(service)) won’t match it unless we handle that variant — which can lead to “service not supported” or missing defaults.

So these are simply aliases that treat those stored values the same as the equivalent provider, so older/existing records work smoothly.

If you prefer, I can update the inline comment to be more explicit, e.g.:

Alias for service values already stored by Desk/Email Account (Outlook.com, Yahoo Mail, Yandex.Mail).

@RitvikSardana
Copy link
Member

Also pull latest changes
@artykbasar

- Add Email Domain link field for Custom provider and auto-fill server settings
- Open Email Domain/Email Account in Desk for create/edit
- Avoid sending Custom-domain fields for non-Custom providers
- Add service aliases for legacy Email Account service values (e.g. Outlook.com, Yahoo Mail, Yandex.Mail)
@artykbasar artykbasar force-pushed the feat/email-domain-desk-links-clean branch from a2a8044 to 43038ec Compare January 13, 2026 20:07
@artykbasar
Copy link
Contributor Author

Hi @RitvikSardana, thanks for the detailed review 🙏

I’ve addressed all the feedback and squashed the changes into a single clean commit (43038ecd9) for easier review.

Summary of updates

  • Reordered Incoming/Outgoing SSL/TLS fields with clearer labels as suggested.
  • Switched to the standard frappe-ui Link component for Email Domain selection.
  • Split common/provider state and Custom-domain state so non-Custom providers (Gmail, Outlook, etc.) don’t send unnecessary fields.
  • Refactored form state types into extendable base + provider + custom types.
  • Added explicit early returns in Email Domain watchers when provider isn’t Custom.
  • Updated the “Read more” link to the Email Domain documentation.
  • Clarified inline comments for service aliases to explain backwards compatibility with existing Desk Email Account records.

The branch is now rebased on latest develop, build/migrate succeeded locally, and the working tree is clean.

Please let me know if you’d like any further tweaks.
Screenshot 2026-01-13 at 20 35 58

@RitvikSardana RitvikSardana requested review from Copilot and removed request for Copilot January 23, 2026 15:26
@codecov
Copy link

codecov bot commented Jan 23, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 50.56%. Comparing base (4c73593) to head (d811720).
⚠️ Report is 78 commits behind head on develop.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #2850      +/-   ##
===========================================
+ Coverage    50.54%   50.56%   +0.01%     
===========================================
  Files          122      122              
  Lines         5403     5403              
===========================================
+ Hits          2731     2732       +1     
+ Misses        2672     2671       -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@RitvikSardana
Copy link
Member

Thank you so much for this feature @artykbasar 🙏🏻
It was highly requested!

@RitvikSardana RitvikSardana merged commit d7633c8 into frappe:develop Feb 9, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

cant select email account

2 participants