E-mail Utilities

Module: ppc_robot_lib.utils.email

class EmailAddress(address: str, display_name: str | None = None)[source]
Email address according to updated RFC 2822

Create new instance of EmailAddress(address, display_name)

address: str

Alias for field number 0

display_name: str | None

Alias for field number 1

render_and_inline_template(template_name, context, base_path_relative=None, base_url=None)[source]

Renders a Django HTML template and inlines CSS rules using Premailer.

Parameters:
  • template_name (str) – Name of the Django HTML template to render.

  • context (dict[str, Any]) – Rendering context (= template variables).

  • base_path_relative – Path where the CSS referenced in the template are stored. This path can be relative to the template file.

  • base_url – Base URL that will be used to convert relative links to absolute.

Return type:

str

Returns:

Rendered HTML.