konigle.managers.comm.email
¶
Email managers for the Konigle SDK.
This module provides manager classes for email accounts, channels, identities, and email operations with complete CRUD support.
AsyncEmailAccountManager
¶
Bases: BaseEmailAccountManager, BaseAsyncManager
Asynchronous manager for email account resources.
check_status()
async
¶
create(data)
async
¶
Create a new email account.
| PARAMETER | DESCRIPTION |
|---|---|
data
|
Email account creation data including all required fields
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
EmailAccount
|
Created email account instance with Active Record capabilities |
setup(data)
async
¶
Set up a new email account along with its default channel and identity. Args: data: Email account setup data including all required fields Returns: A dictionary containing the created email account, its default channel, and identity. Example:
setup_data = EmailAccountSetup(
name="Marketing Account",
default_from_email=""
default_reply_to_email=""
identity_value="example.com",
)
setup_result = await client.email_accounts.setup(setup_data)
account = setup_result["account"]
channel = setup_result["channels"][0]
identity = setup_result["identity"]
AsyncEmailChannelManager
¶
Bases: BaseEmailChannelManager, BaseAsyncManager
Asynchronous manager for email channel resources.
create(data)
async
¶
Create a new email channel.
| PARAMETER | DESCRIPTION |
|---|---|
data
|
Email channel creation data including all required fields
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
EmailChannel
|
Created email channel instance with Active Record capabilities |
set_engagement_tracking(channel_id, enable)
async
¶
Enable or disable engagement tracking for the channel.
| PARAMETER | DESCRIPTION |
|---|---|
channel_id
|
ID of the channel to update
TYPE:
|
enable
|
True to enable engagement tracking, False to disable
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
EmailChannel
|
Updated channel instance with engagement tracking setting |
AsyncEmailIdentityManager
¶
Bases: BaseEmailIdentityManager, BaseAsyncManager
Asynchronous manager for email identity resources.
check_verification_status(identity_id)
async
¶
Check verification status for an email identity.
| PARAMETER | DESCRIPTION |
|---|---|
identity_id
|
ID of the identity to verify
TYPE:
|
Returns: Updated identity instance with verification status Example:
create(data)
async
¶
Create a new email identity.
| PARAMETER | DESCRIPTION |
|---|---|
data
|
Email identity creation data including all required fields
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
EmailIdentity
|
Created email identity instance with Active Record capabilities |
setup_custom_mail_from(identity_id, mail_from_domain)
async
¶
Setup custom MAIL FROM domain for an email identity. Args: identity_id: ID of the identity to setup custom MAIL FROM mail_from_domain: Custom MAIL FROM domain to be set Returns: Updated identity instance with custom MAIL FROM domain that is pending verification. The returned instance includes the dns records that need to be added for verification.
AsyncEmailManager
¶
Bases: BaseEmailManager
Asynchronous manager for email operations.
Provides async functionality for sending emails and other email-related actions that don't involve resource management.
send(data)
async
¶
Send an email through the Konigle email service.
| PARAMETER | DESCRIPTION |
|---|---|
data
|
Email data model instance or dict containing email details
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
EmailResponse
|
SendEmailResponse with success message and optional IDs |
Example
from konigle.models.comm import Email
email_data = Email(
to_email=["recipient@example.com"],
subject="Welcome to Konigle",
body_html="<h1>Welcome!</h1><p>Thanks for signing up.</p>",
body_text="Welcome! Thanks for signing up.",
channel="welcome-emails",
save_as_template=False
)
response = await client.emails.send(email_data)
print(f"Email sent: {response.message}")
AsyncEmailTemplateManager
¶
Bases: BaseEmailTemplateManager, BaseAsyncManager
Asynchronous manager for email template resources.
create(data)
async
¶
Create a new email template.
| PARAMETER | DESCRIPTION |
|---|---|
data
|
Email template creation data including all required fields
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
EmailTemplate
|
Created email template instance with Active Record capabilities |
Example
template_data = EmailTemplateCreate(
name="Welcome Email",
code="welcome-email",
subject="Welcome to {{company_name}}!",
body_html="<h1>Welcome!</h1><p>Thanks for joining.</p>",
body_text="Welcome! Thanks for joining.",
tags=["welcome", "onboarding"]
)
template = await client.email_templates.create(template_data)
print(f"Created template: {template.name}")
EmailAccountManager
¶
Bases: BaseEmailAccountManager, BaseSyncManager
Synchronous manager for email account resources.
check_status()
¶
create(data)
¶
Create a new email account.
| PARAMETER | DESCRIPTION |
|---|---|
data
|
Email account creation data including all required fields
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
EmailAccount
|
Created email account instance with Active Record capabilities |
setup(data)
¶
Set up a new email account along with its default channel and identity. Args: data: Email account setup data including all required fields Returns: A dictionary containing the created email account, its default channel, and identity. Example:
setup_data = EmailAccountSetup(
name="Marketing Account",
default_from_email=""
default_reply_to_email=""
identity_value="example.com",
)
setup_result = client.email_accounts.setup(setup_data)
account = setup_result["account"]
channel = setup_result["channels"][0]
identity = setup_result["identity"]
EmailChannelManager
¶
Bases: BaseEmailChannelManager, BaseSyncManager
Synchronous manager for email channel resources.
create(data)
¶
Create a new email channel.
| PARAMETER | DESCRIPTION |
|---|---|
data
|
Email channel creation data including all required fields
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
EmailChannel
|
Created email channel instance with Active Record capabilities |
set_engagement_tracking(channel_id, enable)
¶
Enable or disable engagement tracking for the channel.
| PARAMETER | DESCRIPTION |
|---|---|
channel_id
|
ID of the channel to update
TYPE:
|
enable
|
True to enable engagement tracking, False to disable
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
EmailChannel
|
Updated channel instance with engagement tracking setting |
EmailIdentityManager
¶
Bases: BaseEmailIdentityManager, BaseSyncManager
Synchronous manager for email identity resources.
check_verification_status(identity_id)
¶
Check verification status for an email identity.
| PARAMETER | DESCRIPTION |
|---|---|
identity_id
|
ID of the identity to verify
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
EmailIdentity
|
Updated identity instance with verification status |
create(data)
¶
Create a new email identity.
| PARAMETER | DESCRIPTION |
|---|---|
data
|
Email identity creation data including all required fields
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
EmailIdentity
|
Created email identity instance with Active Record capabilities |
setup_custom_mail_from(identity_id, mail_from_domain)
¶
Setup custom MAIL FROM domain for an email identity.
| PARAMETER | DESCRIPTION |
|---|---|
identity_id
|
ID of the identity to setup custom MAIL FROM
TYPE:
|
mail_from_domain
|
Custom MAIL FROM domain to be set
TYPE:
|
Returns: Updated identity instance with custom MAIL FROM domain that is pending verification. The returned instance includes the dns records that need to be added for verification.
EmailManager
¶
Bases: BaseEmailManager
Synchronous manager for email operations.
Provides functionality for sending emails and other email-related actions that don't involve resource management.
send(data)
¶
Send an email through the Konigle email service.
| PARAMETER | DESCRIPTION |
|---|---|
data
|
Email data model instance or dict containing email details
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
EmailResponse
|
SendEmailResponse with success message and optional IDs |
Example
from konigle.models.comm import Email
email_data = Email(
to_email=["recipient@example.com"],
subject="Welcome to Konigle",
body_html="<h1>Welcome!</h1><p>Thanks for signing up.</p>",
body_text="Welcome! Thanks for signing up.",
channel="welcome-emails",
save_as_template=False
)
response = client.emails.send(email_data)
print(f"Email sent: {response.message}")
EmailTemplateManager
¶
Bases: BaseEmailTemplateManager, BaseSyncManager
Synchronous manager for email template resources.
create(data)
¶
Create a new email template.
| PARAMETER | DESCRIPTION |
|---|---|
data
|
Email template creation data including all required fields
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
EmailTemplate
|
Created email template instance with Active Record capabilities |
Example
template_data = EmailTemplateCreate(
name="Welcome Email",
code="welcome-email",
subject="Welcome to {{company_name}}!",
body_html="<h1>Welcome!</h1><p>Thanks for joining.</p>",
body_text="Welcome! Thanks for joining.",
tags=["welcome", "onboarding"]
)
template = client.email_templates.create(template_data)
print(f"Created template: {template.name}")