Email

Email Notifications

Tasks related to creation of Email notifications

tamr_toolbox.notifications.emails.send_email(*, message, subject_line, sender_address, sender_password, recipient_addresses, smtp_server, smtp_port, use_tls=True, keyfile=None, certfile=None)[source]

Sends a message via email to list of recipients

Parameters
  • message (str) – Body of email message

  • subject_line (str) – subject of email

  • sender_address (str) – email address to send message from ex: my_pipeline@gmail.com

  • sender_password (str) – password to login to sender_email

  • recipient_addresses (List[str]) – list of emails to send message to ex: [client_email@gmail.com]

  • smtp_server (str) – smtp server address of sender_email ex: smtp.gmail.com

  • smtp_port (str) – port to send email from, use 465 for SSL, use 587 for TLS

  • use_tls (bool) – A boolean value to turn on/off TLS protocol

  • keyfile (Optional[str]) – the private key to a TLS/SSL certificate, usually PEM format

  • certfile (Optional[str]) – TLS/SSL cert file issued by a Certificate Authority (CA), usually PEM format

Return type

Dict[str, Any]

Returns

A dict with the message and response codes from the smtp server if there are any errors. The dictionary will contain one entry for each recipient that was refused. Each entry contains a tuple of the SMTP error code and the accompanying error message sent by the server. A successful response will contain an empty dict.

Raises

SMTPException. The base exception class used by the smtplib module

tamr_toolbox.notifications.emails.monitor_job(tamr, *, sender_address, sender_password, recipient_addresses, smtp_server, smtp_port, operation, poll_interval_seconds=1, timeout_seconds=None, notify_states=None, use_tls=False, keyfile=None, certfile=None)[source]

Monitors a Tamr Operation and sends an email when the job status is updated

Parameters
  • tamr (Client) – A Tamr client

  • sender_address (str) – email address to send message from ex: my_pipeline@gmail.com

  • sender_password (str) – password to login to sender_email

  • recipient_addresses (List[str]) – list of emails to send message to ex: [client_email@gmail.com]

  • smtp_server (str) – smtp server address of sender_email ex: smtp.gmail.com

  • smtp_port (str) – port to send email from, use 465 for SSL

  • operation (Union[int, str, Operation]) – A job ID or a Tamr operation

  • poll_interval_seconds (float) – Time interval (in seconds) between subsequent polls

  • timeout_seconds (Optional[float]) – Time (in seconds) to wait

  • notify_states (Optional[List[OperationState]]) – States for which notifications should be sent, use None for all states

  • use_tls (bool) – A boolean value to opt to use TLS protocol

  • keyfile (Optional[str]) – the private key to a TLS/SSL certificate, usually PEM format

  • certfile (Optional[str]) – TLS/SSL cert file issued by a Certificate Authority (CA), usually PEM format

Return type

List[Tuple[str, Dict[str, Any]]]

Returns

A list of dicts. Each dict comtains the message and error response codes from the smtp server. The dictionary will contain one entry for each recipient that was refused. Each entry contains a tuple of the SMTP error code and the accompanying error message sent by the server. A successful response will contain an empty dict.