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 messagesubject_line (
str
) – subject of emailsender_address (
str
) – email address to send message from ex: my_pipeline@gmail.comsender_password (
str
) – password to login to sender_emailrecipient_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.comsmtp_port (
str
) – port to send email from, use 465 for SSL, use 587 for TLSuse_tls (
bool
) – A boolean value to turn on/off TLS protocolkeyfile (
Optional
[str
]) – the private key to a TLS/SSL certificate, usually PEM formatcertfile (
Optional
[str
]) – TLS/SSL cert file issued by a Certificate Authority (CA), usually PEM format
- Return type
- 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 clientsender_address (
str
) – email address to send message from ex: my_pipeline@gmail.comsender_password (
str
) – password to login to sender_emailrecipient_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.comsmtp_port (
str
) – port to send email from, use 465 for SSLoperation (
Union
[int
,str
,Operation
]) – A job ID or a Tamr operationpoll_interval_seconds (
float
) – Time interval (in seconds) between subsequent pollstimeout_seconds (
Optional
[float
]) – Time (in seconds) to waitnotify_states (
Optional
[List
[OperationState
]]) – States for which notifications should be sent, use None for all statesuse_tls (
bool
) – A boolean value to opt to use TLS protocolkeyfile (
Optional
[str
]) – the private key to a TLS/SSL certificate, usually PEM formatcertfile (
Optional
[str
]) – TLS/SSL cert file issued by a Certificate Authority (CA), usually PEM format
- Return type
- 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.