l.s.m.b.BaseMailer : class documentation

Part of lp.services.mail.basemailer View In Hierarchy

Known subclasses: lp.code.mail.branch.BranchMailer, lp.code.mail.sourcepackagerecipebuild.SourcePackageRecipeBuildMailer, lp.registry.mail.teammembership.TeamMembershipMailer, lp.services.mail.tests.test_basemailer.BaseMailerSubclass, lp.snappy.mail.snapbuild.SnapBuildMailer, lp.soyuz.mail.binarypackagebuild.BinaryPackageBuildMailer, lp.soyuz.mail.livefsbuild.LiveFSBuildMailer, lp.soyuz.mail.packageupload.PackageUploadMailer

Base class for notification mailers.

Subclasses must provide getReason (or reimplement _getTemplateParameters or generateEmail).

It is expected that subclasses may override _getHeaders, _getTemplateParams, and perhaps _getBody.

Method __init__ Constructor.
Method generateEmail Generate the email for this recipient.
Method textDelta Return a textual version of the class delta.
Method sendOne Send notification to one recipient.
Method sendAll Send notifications to all recipients.
Method _getFromAddress Undocumented
Method _getToAddresses Undocumented
Method _getSubject The subject template expanded with the template params.
Method _getReplyToAddress Return the address to use for the reply-to header.
Method _getHeaders Return the mail headers to use.
Method _addAttachments Add any appropriate attachments to a MailController.
Method _getTemplateName Return the name of the template to use for this email body.
Method _getTemplateParams Return a dict of values to use in the body and subject.
Method _getBody Return the complete body to use for this email.
Method _getFooter Provide a footer to attach to the body, or None.
Method _getExpandedFooter Provide an expanded footer for recipients who have requested it.
def __init__(self, subject, template_name, recipients, from_address, delta=None, message_id=None, notification_type=None, mail_controller_class=None, request=None, wrap=False, force_wrap=False):
Constructor.
ParameterssubjectA Python dict-replacement template for the subject line of the email.
templateName of the template to use for the message body.
recipientsA dict of recipient to Subscription.
from_addressThe from_address to use on emails.
deltaA Delta object with members "delta_values", "interface" and "new_values", such as BranchMergeProposalDelta.
message_idThe Message-Id to use for generated emails. If not supplied, random message-ids will be used.
mail_controller_classThe class of the mail controller to use to send the mails. Defaults to MailController.
requestAn optional IErrorReportRequest to use when logging OOPSes.
wrapWrap body text using MailWrapper.
force_wrapSee MailWrapper.format.
def _getFromAddress(self, email, recipient):
Undocumented
def _getToAddresses(self, email, recipient):
Undocumented
def generateEmail(self, email, recipient, force_no_attachments=False):
Generate the email for this recipient.
ParametersemailEmail address of the recipient to send to.
recipientThe Person to send to.
Returns(headers, subject, body) of the email.
def _getSubject(self, email, recipient):
The subject template expanded with the template params.
def _getReplyToAddress(self, email, recipient):
Return the address to use for the reply-to header.
def _getHeaders(self, email, recipient):
Return the mail headers to use.
def _addAttachments(self, ctrl, email):
Add any appropriate attachments to a MailController.

Default implementation does nothing. :param ctrl: The MailController to add attachments to. :param email: The email address of the recipient.

def _getTemplateName(self, email, recipient):
Return the name of the template to use for this email body.
def _getTemplateParams(self, email, recipient):
Return a dict of values to use in the body and subject.
def textDelta(self):
Return a textual version of the class delta.
def _getBody(self, email, recipient):
Return the complete body to use for this email.
def _getFooter(self, email, recipient, params):
Provide a footer to attach to the body, or None.
def _getExpandedFooter(self, headers, recipient):
Provide an expanded footer for recipients who have requested it.
def sendOne(self, email, recipient):
Send notification to one recipient.
def sendAll(self):
Send notifications to all recipients.
API Documentation for Launchpad, generated by pydoctor at 2022-06-16 00:00:12.