Skip to content

Instantly share code, notes, and snippets.

@JMIdeaMaker
Created October 23, 2020 17:34
Show Gist options
  • Save JMIdeaMaker/c34b4034139f556de9e34cc7f3d6bb82 to your computer and use it in GitHub Desktop.
Save JMIdeaMaker/c34b4034139f556de9e34cc7f3d6bb82 to your computer and use it in GitHub Desktop.
from django.core.management.base import BaseCommand
from django.core.mail import send_mail
class Command(BaseCommand):
help = 'Sends a test email to specified input email'
def add_arguments(self, parser):
parser.add_argument('email', type=str)
def handle(self, *args, **options):
email = options.get('email', None)
send_mail(
'Test Subject',
'Test Message',
'noreply@djscaffold.com',
[email],
fail_silently=False,
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment