Skip to main content

Command

This class provides a management command that sends test emails to specified recipients, site managers, or site administrators. It supports passing individual email addresses as arguments or using flags to target addresses defined in the application settings. The command automatically generates a subject line containing the system hostname and current timestamp to verify mail delivery functionality.

Attributes

AttributeTypeDescription
helpstring = "Sends a test email to the email addresses specified as arguments."Sends a test email to the email addresses specified as arguments.
missing_args_messagestring = "You must specify some email recipients, or pass the --managers or --admin options."You must specify some email recipients, or pass the --managers or --admin options.

Methods


add_arguments()

@classmethod
def add_arguments(
parser: ArgumentParser
)

Configures the command line argument parser with options for email recipients, managers, and admins.

Parameters

NameTypeDescription
parserArgumentParserThe argument parser instance to which the email, --managers, and --admins arguments will be added

Returns

TypeDescription
None

handle()

@classmethod
def handle(
*args: tuple,
**kwargs: dict
)

Executes the command logic to send test emails to the specified recipients, site managers, or site administrators.

Parameters

NameTypeDescription
*argstupleVariable length argument list (not used by this command)
**kwargsdictKeyword arguments containing 'email' (list of addresses), 'managers' (boolean), and 'admins' (boolean) to determine recipients

Returns

TypeDescription
None