Django send mail function

126 E-mail Case Study

An advanced 126 mailbox settings, open:

Get an authorization code after successfully opened.
 
2. setting.py configuration:
# Configure the mailbox 
# need to log on Netease mail function to send mail opened! 
EMAIL_USE_SSL = False 
EMAIL_HOST = ' smtp.126.com ' 
EMAIL_PORT = 25 
EMAIL_HOST_USER = ' [email protected] '   # spammers account 
EMAIL_HOST_PASSWORD = ' xxxxxx '   # Mail sent an authorization code to obtain the opening 126 when sending mail. 
DEFAULT_FROM_EMAIL = EMAIL_HOST_USER

3. Send e-mail

send_mail (Subject = ' title ' , the Message = ' Your activation code is: xxxx ' , FROM_EMAIL = ' [email protected] ' , RECIPIENT_LIST = [ ' [email protected] ' ,])

When taking into account the time-consuming operation to send a message, the message should be sent into the asynchronous task execution.

 

 

Guess you like

Origin www.cnblogs.com/bryant24/p/11445837.html