Terarea  2
The automation project
Loading...
Searching...
No Matches
src.lib.components.mail_management.MailManagement Class Reference
Collaboration diagram for src.lib.components.mail_management.MailManagement:
Collaboration graph

Public Member Functions

None __init__ (self, int error=84, int success=0, bool debug=False)
 
int send_email (self, str receiver, str subject, str body, str body_type="html")
 
int send_email_with_attachment (self, str receiver, str subject, str body, List[str] attachments, str body_type="html")
 
int send_email_to_multiple (self, List[str] receivers, str subject, str body, str body_type="html")
 
int send_email_with_inline_image (self, str receiver, str subject, str body, str image_path, str body_type="html")
 

Data Fields

 success = success
 
 error = error
 
 debug = debug
 
 sender = CONST.SENDER_ADDRESS
 
 host = CONST.SENDER_HOST
 
 api_key = CONST.SENDER_KEY
 
 port = CONST.SENDER_PORT
 
Disp disp
 

Protected Member Functions

int _send (self, EmailMessage em)
 

Detailed Description

_summary_

Definition at line 16 of file mail_management.py.

Constructor & Destructor Documentation

◆ __init__()

None src.lib.components.mail_management.MailManagement.__init__ ( self,
int error = 84,
int success = 0,
bool debug = False )
_summary_
    The class in charge of allowing the user to send e-mails.

Args:
    error (int, optional): _description_. Defaults to 84.
    success (int, optional): _description_. Defaults to 0.
    debug (bool, optional): _description_. Defaults to False.

Definition at line 20 of file mail_management.py.

Member Function Documentation

◆ _send()

int src.lib.components.mail_management.MailManagement._send ( self,
EmailMessage em )
protected
Internal method to handle the actual sending of an email.

Args:
    em (EmailMessage): The email message to be sent.

Returns:
    int: The status of the email sending operation.

Definition at line 49 of file mail_management.py.

◆ send_email()

int src.lib.components.mail_management.MailManagement.send_email ( self,
str receiver,
str subject,
str body,
str body_type = "html" )
Sends a simple email to a single receiver.

Args:
    receiver (str): The recipient's email address.
    subject (str): The subject of the email.
    body (str): The content of the email.
    body_type (str, optional): The MIME type of the email content ('html' or 'plain'). Defaults to 'html'.

Returns:
    int: The status of the email sending operation.

Definition at line 71 of file mail_management.py.

◆ send_email_to_multiple()

int src.lib.components.mail_management.MailManagement.send_email_to_multiple ( self,
List[str] receivers,
str subject,
str body,
str body_type = "html" )
Sends an email to multiple recipients (To, Cc, or Bcc).

Args:
    receivers (List[str]): A list of recipients' email addresses.
    subject (str): The subject of the email.
    body (str): The content of the email.
    body_type (str, optional): The MIME type of the email content ('html' or 'plain'). Defaults to 'html'.

Returns:
    int: The status of the email sending operation.

Definition at line 149 of file mail_management.py.

◆ send_email_with_attachment()

int src.lib.components.mail_management.MailManagement.send_email_with_attachment ( self,
str receiver,
str subject,
str body,
List[str] attachments,
str body_type = "html" )
Sends an email with one or more attachments.

Args:
    receiver (str): The recipient's email address.
    subject (str): The subject of the email.
    body (str): The content of the email.
    attachments (List[str]): List of file paths for attachments.
    body_type (str, optional): The MIME type of the email content ('html' or 'plain'). Defaults to 'html'.

Returns:
    int: The status of the email sending operation.

Definition at line 96 of file mail_management.py.

◆ send_email_with_inline_image()

int src.lib.components.mail_management.MailManagement.send_email_with_inline_image ( self,
str receiver,
str subject,
str body,
str image_path,
str body_type = "html" )
Sends an email with an inline image embedded in the body.

Args:
    receiver (str): The recipient's email address.
    subject (str): The subject of the email.
    body (str): The content of the email, including a placeholder for the image.
    image_path (str): The path to the image to be embedded.
    body_type (str, optional): The MIME type of the email content ('html' or 'plain'). Defaults to 'html'.

Returns:
    int: The status of the email sending operation.

Definition at line 174 of file mail_management.py.

Field Documentation

◆ api_key

src.lib.components.mail_management.MailManagement.api_key = CONST.SENDER_KEY

Definition at line 36 of file mail_management.py.

◆ debug

src.lib.components.mail_management.MailManagement.debug = debug

Definition at line 31 of file mail_management.py.

◆ disp

Disp src.lib.components.mail_management.MailManagement.disp
Initial value:
= Disp(
TOML_CONF,
SAVE_TO_FILE,
FILE_NAME,
FILE_DESCRIPTOR,
debug=self.debug,
logger=self.__class__.__name__
)

Definition at line 40 of file mail_management.py.

◆ error

src.lib.components.mail_management.MailManagement.error = error

Definition at line 30 of file mail_management.py.

◆ host

src.lib.components.mail_management.MailManagement.host = CONST.SENDER_HOST

Definition at line 35 of file mail_management.py.

◆ port

src.lib.components.mail_management.MailManagement.port = CONST.SENDER_PORT

Definition at line 37 of file mail_management.py.

◆ sender

src.lib.components.mail_management.MailManagement.sender = CONST.SENDER_ADDRESS

Definition at line 34 of file mail_management.py.

◆ success

src.lib.components.mail_management.MailManagement.success = success

Definition at line 29 of file mail_management.py.


The documentation for this class was generated from the following file: