etl_craft.handlers.mail ¶
Sending email as the Email settings of craft-connector.yml say.
Every email is HTML, sent from the profile's from_address under its from_name, when set,
in one of two ways:
transport: smtp(the default): through the SMTP relay athost:port, with verified STARTTLS or implicit TLS, logged in to byauth_mode:none,password, oroauth(SMTP XOAUTH2 with a client-credentials token, for relays that refuse passwords);transport: sendmail: handed to the host'ssendmailprogram (sendmail_path), the onemailxandmailuse, which delivers it through the host's own mail system.
A failure names the relay or program and what went wrong.
SMTP_TIMEOUT_SECONDS
module-attribute
¶
How long the relay may take to answer each step.
parse_recipients ¶
Split a |-separated address list; HandlerError naming a malformed address.
send_email ¶
send_email(config: ConnectorConfig, recipients: Sequence[str], subject: str, body_html: str) -> str | None
Send HTML email; return a partial-refusal warning, or fail with the transport and cause.
safe_subject ¶
Return a single line without control characters, capped at 200 characters.
email_tls_problem ¶
Return unsafe or unusable TLS settings, naming the profile and the remedy.
tls_context ¶
Create a certificate and hostname verifying context using the configured CA.
open_smtp ¶
Connect with the selected SMTP transport, refusing credentials without TLS.
sendmail_problem ¶
Return why the profile's sendmail program cannot be run, or None.
sla_recipients ¶
Return who hears about a pipeline's SLA: its EMAIL_RECIPIENTS, else the DAG default.
HandlerError when neither is set, naming both places.
send_sla_lapse_email ¶
send_sla_lapse_email(config: ConnectorConfig, pipeline_recipients: Sequence[str] | None, *, pipeline_code: str, pipeline_run_id: int, sla_hours: float, elapsed_hours: float) -> None
Email that a run is past its pipeline's SLA; only when Enforce_sla is on.