cpl_core.mailing package

Submodules

cpl_core.mailing.email module

class cpl_core.mailing.email.EMail(header: list[str] | None = None, subject: str | None = None, body: str | None = None, transceiver: str | None = None, receiver: list[str] | None = None)

Bases: object

Represents an email

Parameter:
header: list[str]

Header of the E-Mail

subject: str

Subject of the E-Mail

body: str

Body of the E-Mail

transceiver: str

Transceiver of the E-Mail

receiver: list[str]

Receiver of the E-Mail

add_header(header: str)

Adds header

Parameter:
header: str

The header of the E-Mail

add_receiver(receiver: str)

Adds receiver

Parameter:
receiver: str

The receiver of the E-Mail

property body: str
static check_mail(address: str) bool

Checks if an email is valid

Parameter:
address: str

The address to check

Returns:

Result if E-Mail is valid or not

get_content(transceiver: str)

Returns the mail as string

Parameter:
transceiver: str

The transceiver of the E-Mail

Returns:

E-Mail as string

property header: str
property header_list: list[str]
property receiver: str
property receiver_list: list[str]
property subject: str
property transceiver: str

cpl_core.mailing.email_client_abc module

class cpl_core.mailing.email_client_abc.EMailClientABC

Bases: ABC

ABC of cpl_core.mailing.email_client_service.EMailClient

abstract connect()

Connects to server

abstract send_mail(email: EMail)

Sends email

Parameter:
email: cpl_core.mailing.email.EMail

Object of the E-Mail to send

cpl_core.mailing.email_client_service module

class cpl_core.mailing.email_client_service.EMailClient(environment: ApplicationEnvironmentABC, logger: LoggerABC, mail_settings: EMailClientSettings)

Bases: EMailClientABC

Service to send emails

Parameter:
environment: cpl_core.environment.application_environment_abc.ApplicationEnvironmentABC

Environment of the application

logger: cpl_core.logging.logger_abc.LoggerABC

The logger to use

mail_settings: cpl_core.mailing.email_client_settings.EMailClientSettings

Settings for mailing

connect()

Connects to server

create()

Creates connection

login()

Login to server

send_mail(email: EMail)

Sends email

Parameter:
email: cpl_core.mailing.email.EMail

Object of the E-Mail to send

cpl_core.mailing.email_client_settings module

class cpl_core.mailing.email_client_settings.EMailClientSettings(host: str | None = None, port: int | None = None, user_name: str | None = None, credentials: str | None = None)

Bases: ConfigurationModelABC

Representation of mailing settings

property credentials: str
property host: str
property port: int
property user_name: str

cpl_core.mailing.email_client_settings_name_enum module

class cpl_core.mailing.email_client_settings_name_enum.EMailClientSettingsNameEnum(value)

Bases: Enum

An enumeration.

credentials = 'Credentials'
host = 'Host'
port = 'Port'
user_name = 'UserName'

Module contents

cpl-core CPL core

CPL core package

copyright:
  1. 2020 - 2023 sh-edraft.de

license:

MIT, see LICENSE for more details.

class cpl_core.mailing.VersionInfo(major, minor, micro)

Bases: tuple

major

Alias for field number 0

micro

Alias for field number 2

minor

Alias for field number 1