cardinal_pythonlib.bulk_email.models


Original code copyright (C) 2009-2022 Rudolf Cardinal (rudolf@pobox.com).

This file is part of cardinal_pythonlib.

Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.


SQLAlchemy models for the simple bulk e-mail tool.

class cardinal_pythonlib.bulk_email.models.Config(*args, **kwargs)[source]

Stores records of configuration information.

Maintains history (so the config for previous send jobs is visible), per:

Default configuration.

classmethod get_current_config(session: Session) Config[source]

Fetch the current config, or raise.

classmethod get_or_create_config(session: Session) Config[source]

Fetch the current config, or make a new one.

new_version(session: Session) None[source]

Called by listener (see above) when object is being saved.

property password: str

Returns the plaintext password.

class cardinal_pythonlib.bulk_email.models.Content(**kwargs)[source]

Contents of an e-mail that will be, or has been, sent to one or many recipients.

A simple constructor that allows initialization from kwargs.

Sets attributes on the constructed instance using the names and values in kwargs.

Only keys that are present as attributes of the instance’s class are allowed. These could be, for example, any mapped columns or relationships.

class cardinal_pythonlib.bulk_email.models.Job(**kwargs)[source]

A task to send one e-mail to one recipient.

A simple constructor that allows initialization from kwargs.

Sets attributes on the constructed instance using the names and values in kwargs.

Only keys that are present as attributes of the instance’s class are allowed. These could be, for example, any mapped columns or relationships.

class cardinal_pythonlib.bulk_email.models.Recipient(*args, **kwargs)[source]

Details of an e-mail recipient.

A simple constructor that allows initialization from kwargs.

Sets attributes on the constructed instance using the names and values in kwargs.

Only keys that are present as attributes of the instance’s class are allowed. These could be, for example, any mapped columns or relationships.

classmethod fetch_or_add(email: str, session: Session) Recipient[source]

Fetch or create/add the recipient.

class cardinal_pythonlib.bulk_email.models.SendAttempt(**kwargs)[source]

Records the attempt to send an e-mail. Success means that it was accepted by our local server – that doesn’t imply final delivery (e.g. if the address is wrong).

A simple constructor that allows initialization from kwargs.

Sets attributes on the constructed instance using the names and values in kwargs.

Only keys that are present as attributes of the instance’s class are allowed. These could be, for example, any mapped columns or relationships.

cardinal_pythonlib.bulk_email.models.make_table_args(*args, **kwargs) Tuple[Any][source]

SQLAlchemy allows several formats for __table_args__. The most generic is a tuple that is a sequence of e.g. constraints, with the last element being a dictionary of keyword arguments.