Skip to content

hook

hook

__all__ = ['GoogleEmailHook'] module-attribute

GoogleEmailHook

Bases: EmailHook

Hook for sending emails using Google Email service.

__init__() -> None

Initializes the GoogleEmailHook.

build_message(subject: str, content: str, recipients: list, sender: str, attachments: list = [], mime_type: str = 'plain') -> Union[MIMEMultipart, MIMEText]

Builds an email message with optional attachments.

Parameters:

Name Type Description Default
subject str

The subject of the email.

required
content str

The body content of the email.

required
recipients list

A list of recipient email addresses.

required
sender str

The email address of the sender.

required
attachments list

A list of attachment dictionaries. Each dictionary should contain 'name', 'content', and optionally 'type'. Defaults to an empty list.

[]
mime_type str

The MIME type of the email body content. Defaults to 'plain'.

'plain'

Returns:

Type Description
Union[MIMEMultipart, MIMEText]

Union[MIMEMultipart, MIMEText]: The constructed email message object.

send(subject: str, content: str, recipients: List[str], sender: str, attachments: List[dict], mime_type: str) -> None

Sends an email.

Parameters:

Name Type Description Default
subject str

The subject of the email.

required
content str

The content of the email.

required
recipients List[str]

The list of email recipients.

required
sender str

The sender's email address.

required
attachments List[dict]

The list of attachments.

required
mime_type str

The MIME type of the email content.

required