BloomERP

Built-ins

EmailProviderDefinition

Describe an email transport and the fields required to connect an account.

The registry resolves the transport from the provider ID stored on the account. The definition controls setup fields, defaults, authorization, and synchronization capabilities.

SettingTypeDefaultDescription
idstrRequiredStable ID stored on email accounts that use this provider.
documentationstr''Markdown and tagged examples included in the generated developer reference.
namestrRequiredName shown when adding an email account.
descriptionstr | PromiseRequiredSummary of the provider's supported transport.
iconstrRequiredIcon shown for this provider.
adapter_classtype[BaseEmailAdapter]RequiredTransport adapter class for incoming and outgoing email.
fieldslist[str][]Connection form fields offered by this provider.
required_fieldslist[str][]Connection form fields that must be supplied.
initialdict[str, Any]{}Initial connection form values.
setup_instructionsstr | NoneNoneSetup instructions shown to the account owner.
sync_capabilitiesEmailSyncCapabilityFactory: EmailSyncCapabilitySync features implemented by this provider.
authorizationOptional[Annotated[EmailAuthorizationDefinition, SkipValidation()]]NoneOAuth setup metadata when the provider uses authorization.
mailbox_defaultsCallable[[BaseEmailAdapter], dict[str, dict[str, Any]]] | NoneNoneCallback that supplies initial folder settings for a connected mailbox.

Add an account preset for a known mail server

Reuse the IMAP and SMTP adapter. Use the example hosts as placeholders for your organization’s servers.

python
from bloomerp.communication.builtins.emails.email_providers import EmailProvider
from bloomerp.communication.builtins.emails.provider_definition import EmailProviderDefinition
from bloomerp.communication.builtins.emails.registry import EMAIL_PROVIDER_REGISTRY

imap = EmailProvider.IMAP.value
operations = EmailProviderDefinition(
    id="example_operations_mail",
    name="Operations mail",
    description="IMAP and SMTP setup for operations mailboxes.",
    icon=imap.icon,
    adapter_class=imap.adapter_class,
    fields=imap.fields,
    required_fields=imap.required_fields,
    initial={"imap_host": "imap.example.com", "smtp_host": "smtp.example.com"},
)
EMAIL_PROVIDER_REGISTRY.register("EXAMPLE_OPERATIONS_MAIL", operations)

Set the polling interval for a provider preset

Keep the original transport and account fields while publishing a different polling default.

python
from bloomerp.communication.builtins.emails.email_providers import EmailProvider
from bloomerp.communication.builtins.emails.provider_definition import EmailSyncCapability
from bloomerp.communication.builtins.emails.registry import EMAIL_PROVIDER_REGISTRY

archive_mail = EmailProvider.IMAP.value.model_copy(
    update={
        "id": "example_archive_mail",
        "name": "Archive mail",
        "sync_capabilities": EmailSyncCapability(default_poll_interval_minutes=15),
    },
)
EMAIL_PROVIDER_REGISTRY.register("EXAMPLE_ARCHIVE_MAIL", archive_mail)

Microsoft 365 / Outlook

ID outlook · Lookup ID OUTLOOK

Connect a mailbox with delegated Microsoft Graph authorization.

FieldValue
iconfa-brands fa-microsoft
setup_instructions<div class="space-y-2 text-sm text-slate-600"> <p>Enter your Microsoft Entra application's client ID, client secret value and directory tenant ID, then sign in to authorize this mailbox.</p> <ul class="list-disc space-y-1 pl-5"> <li>Register the callback below as a Web redirect URI. This page must use HTTPS.</li> <li>Configure delegated User.Read, Mail.ReadWrite and Mail.Send permissions. Your organization may require administrator consent.</li> <li>Use the tenant UUID for the mailbox organization. Mailbox passwords are not needed.</li> <li>Disconnect removes local mailbox tokens. Revoke consent separately in Microsoft if needed.</li> </ul> </div>

IMAP / SMTP

ID imap · Lookup ID IMAP

Connect a mailbox with incoming and outgoing server credentials.

FieldValue
iconfa-solid fa-envelope-open-text
setup_instructions<div class="space-y-2 text-sm text-slate-600"> <p>Use the incoming and outgoing server settings provided by the mailbox host.</p> <ul class="list-disc space-y-1 pl-5"> <li>Enter the mailbox address and, when different, the login username.</li> <li>Use an app password when the provider requires one for IMAP or SMTP access.</li> <li>Enter the IMAP host, port, and security mode for incoming mail.</li> <li>Enter the SMTP host, port, and security mode for outgoing mail.</li> <li>For an alias, set the SMTP envelope sender to the primary mailbox address if your provider requires it. Leave it blank otherwise. Some providers display the primary mailbox as sending on behalf of the alias.</li> </ul> </div>