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
| Attribute | Type | Description |
|---|---|---|
| help | string = "Sends a test email to the email addresses specified as arguments." | Sends a test email to the email addresses specified as arguments. |
| missing_args_message | string = "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
| Name | Type | Description |
|---|---|---|
| parser | ArgumentParser | The argument parser instance to which the email, --managers, and --admins arguments will be added |
Returns
| Type | Description |
|---|---|
| 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
| Name | Type | Description |
|---|---|---|
| *args | tuple | Variable length argument list (not used by this command) |
| **kwargs | dict | Keyword arguments containing 'email' (list of addresses), 'managers' (boolean), and 'admins' (boolean) to determine recipients |
Returns
| Type | Description |
|---|---|
| None |