Email Account setup in Frappe Helpdesk

Hi, I have a support email as itsupport@abc.com which setup as Shared Mailbox in Microsoft 365.

Can I know how to setup in Frappe Helpdesk > Settings > Email Account?
This shared mailbox is used to receive and sent the IT Support cases.

Thanks.

  1. Go to Email Account > Create Email Account.
  2. Enable Incoming and configure the IMAP Details:
    • Add the folder name (e.g., INBOX).

    • Set Append To as HD Ticket.

  3. In the HD Ticket customization form, enable “Allow document creation via email” under email setting section.
  4. For detailed reference, see the Frappe documentation on email account setup for Helpdesk is attached below.

Hi, thanks for the doc: microsoft-email-oauth. I followed and completed the setup.

I tried to pull emails, but the email did not go into case. There is error log as below.

Traceback with variables (most recent call last):
  File "apps/helpdesk/helpdesk/overrides/email_account.py", line 72, in get_inbound_mails
    if email_server.select_imap_folder(folder.folder_name):
      self = <CustomEmailAccount: IT Desk>
      process_mail = <function CustomEmailAccount.get_inbound_mails.<locals>.process_mail at 0x7f7b65d8dc60>
      email_sync_rule = 'UNSEEN'
      email_server = <frappe.email.receive.EmailServer object at 0x7f7b672400d0>
      folder = <IMAPFolder: 0e0jk4e6nm parent=IT Desk>
      mails = []
  File "apps/frappe/frappe/email/receive.py", line 160, in select_imap_folder
    res = self.imap.select(f'"{folder}"')
      self = <frappe.email.receive.EmailServer object at 0x7f7b672400d0>
      folder = 'Inbox'
  File "/usr/lib/python3.11/imaplib.py", line 765, in select
    typ, dat = self._simple_command(name, mailbox)
      self = <imaplib.IMAP4_SSL object at 0x7f7b670cc650>
      mailbox = '"Inbox"'
      readonly = False
      name = 'SELECT'
  File "/usr/lib/python3.11/imaplib.py", line 1239, in _simple_command
    return self._command_complete(name, self._command(name, *args))
      self = <imaplib.IMAP4_SSL object at 0x7f7b670cc650>
      name = 'SELECT'
      args = ('"Inbox"',)
  File "/usr/lib/python3.11/imaplib.py", line 1064, in _command_complete
    raise self.error('%s command error: %s %s' % (name, typ, data))
      self = <imaplib.IMAP4_SSL object at 0x7f7b670cc650>
      name = 'SELECT'
      tag = b'LDOL2'
      logout = False
      typ = 'BAD'
      data = [b'User is authenticated but not connected.']
imaplib.error: SELECT command error: BAD [b'User is authenticated but not connected.']

The last error - User is authenticated but not connected.

Permissions granted in App Registration but still no luck.

Hi,
I managed to solve it. Not the Frappe’s issue, the problem is due to the M365 settings.
Need to make sure the email account or the member in the shared mailbox is IMAP enabled.

Don’t trust the mail setting in the M365 Dashboard. Mine already showing enabled and purposely toggle to disabled > save it > enabled > save again.

But when running the script in PowerShell:
Get-CASMailbox -Identity yourmailbox@domain.com | fl SmtpClientAuthenticationDisabled, ImapEnabled

Result returned:

SmtpClientAuthenticationDisabled: True ←—- not ok
ImapEnabled: False ←– not ok

Then I run the below.
Set-CASMailbox -Identity yourmailbox@domain.com -ImapEnabled $true
Set-CASMailbox -Identity yourmailbox@domain.com -SmtpClientAuthenticationDisabled $false

Delete everything in App Registration for Frappe under Microsoft Entra.
Delete the Connected App and Email Account in Frappe Helpdesk.
Redo everything again.

Now no more error.