mail¶
mail ¶
WorkflowStatus ¶
Bases: StrEnum
Outcome reported by the notify command, from either the main download/build/upload pipeline or the separate, approval-gated publish pipeline (publish.Jenkinsfile).
Source code in source/src/imarina_load_researchers/core/mail.py
EmailContent dataclass ¶
get_access_token ¶
Requests a Graph API app-only access token via the client-credentials flow.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
tenant_id | str | Azure AD tenant ID. | required |
client_id | str | App registration's client ID. | required |
client_secret | str | App registration's client secret. | required |
Returns:
| Name | Type | Description |
|---|---|---|
str | str | The bearer access token. |
Raises:
| Type | Description |
|---|---|
HTTPError | If the token request fails. |
Source code in source/src/imarina_load_researchers/core/mail.py
get_creator_email ¶
Looks up the email and display name of whoever created an MS List item.
Used by notify to find who to email: the request's original submitter.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
token | str | Graph API bearer access token. | required |
site_id | str | SharePoint site ID hosting the list. | required |
list_id | str | MS List ID. | required |
item_id | str | The list item's ID (the workflow's Operation ID). | required |
Returns:
| Type | Description |
|---|---|
tuple[str, str] | tuple[str, str]: |
Raises:
| Type | Description |
|---|---|
HTTPError | If the Graph API request fails. |
Source code in source/src/imarina_load_researchers/core/mail.py
send_email ¶
Sends an email over SMTP with STARTTLS (Microsoft 365 SMTP).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
message | EmailContent | The email to send. | required |
username | str | SMTP auth username. | required |
password | str | SMTP auth password. | required |
server | str | SMTP server hostname. | required |
port | int | SMTP server port. | required |
Raises:
| Type | Description |
|---|---|
SMTPException | If the connection, login or send fails. |
Source code in source/src/imarina_load_researchers/core/mail.py
build_success_body ¶
Builds the email body for a successful download/build/upload run.
Tells the requester their generated file is on SharePoint for review - see build_published_body for the wording used once it's been published instead.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name | str | Requester's display name. | required |
item_id | str | The workflow's Operation ID. | required |
sharepoint_path | str | SharePoint path where the file was uploaded. | required |
Returns:
| Name | Type | Description |
|---|---|---|
str | str | The plain-text email body. |
Source code in source/src/imarina_load_researchers/core/mail.py
build_published_body ¶
Builds the email body for a successful publish run.
Distinct from build_success_body because a requester whose file has already been published shouldn't be told to go review it.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name | str | Requester's display name. | required |
item_id | str | The workflow's Operation ID. | required |
Returns:
| Name | Type | Description |
|---|---|---|
str | str | The plain-text email body. |
Source code in source/src/imarina_load_researchers/core/mail.py
build_error_body ¶
Builds the email body for a failed pipeline run (--status error).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name | str | Requester's display name. | required |
item_id | str | The workflow's Operation ID. | required |
Returns:
| Name | Type | Description |
|---|---|---|
str | str | The plain-text email body. |