import threading from django.core.mail import EmailMessage from django.conf import settings class EmailThread(threading.Thread): def __init__(self, email_message): self.email_message = email_message threading.Thread.__init__(self) def run(self): print(self.email_message.send()) email_message = EmailMessage( "subject", "message", settings.EMAIL_HOST_USER, ["example@mail.com"] ) EmailThread(email_message).start()
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter