ox.apps.mails
This application provide mail sending capabilities to Oxylus. Mails are sent in background tasks.
It allows users to configure multiple email accounts and send simple mail. The programmation interface allows extensible and custom mail sending.
Models
- class ox.apps.mails.models.BaseMail(*args, **kwargs)[source]
Base class for outgoing emails. Later is it planned for incoming too.
This is an abstract model as it shall be subclassed.
- Access
alias of
BaseMailAccess
- parent_attr = 'account'
Field name used for parenting.
ox.apps.mails.apps
- class ox.apps.mails.apps.AppConfig(*args, **kwargs)[source]
- icon: str = 'mdi-mail'
Material design icon class.
- npm_package: str | None = '@oxylus/mails'
Name of the corresponding NPM package to look up for.
Defaults to app label.
- root_url: str = 'ox/mails'
Provide an alternative to app label when we target application in paths.
For example Oxylus will nest template directories as
ox/core/instead ofox_core. The same happens for urls.
ox.apps.mails.send
- class ox.apps.mails.send.MailSend(mail, renderer, account=None)[source]
This class handles sending an email from a model subclassing
BaseMail.-
account:
MailAccount Email account used to send the message. Defaults to mail’s one.
- get_message(recipient, context)[source]
Return EmailMessage to send to provided recipient with rendered content and subject.
- Parameters:
contact – target contact
context (
Context) – extra context
- Return type:
EmailMessage
-
renderer:
Renderer Renderer used for user content.
Important
The variables must match context provided by this class and the method
models.BaseMail.get_recipients()ofmailinstance.
- send(context={})[source]
Send the mail to all mail’s recipients (
models.BaseMail.get_recipients()) through SMTP.Update the mail state once sent.
- Parameters:
context (
dict[str,Any]) – extra context to pass down to content’s Template
-
account:
ox.apps.mails.serializers
ox.apps.mails.tasks
ox.apps.mails.views
- class ox.apps.mails.views.BaseMailViewSet(**kwargs)[source]
Base viewset to use for editing and sending emails.
You must specify permissions for the action ``send``! For example:
perms_map = { # Adapt for your own model "send": ["ox_mails.change_mail"], }
- renderer_path = 'ox.apps.mails.renderers.renderer'
Specify which renderer the MailSend class should use.
- class ox.apps.mails.views.MailAccountViewSet(**kwargs)[source]
- serializer_class
alias of
MailAccountSerializer
- class ox.apps.mails.views.MailViewSet(**kwargs)[source]
View set for the
models.Mail.- serializer_class
alias of
MailSerializer