def send_email(email, type='r'): email_record = EmailVerifyRecord() code = generate_random_code() email_record.code = code email_record.email = email email_record.send_type = type email_record.save() subject = "" message = "" if (type == 'r'): subject = "Gmooc Account Activation" message = "Click this link to activate your account: http://127.0.0.1:8000/activate/{0}.".format( code) send_status = send_mail(subject, message, EMAIL_FROM, [email]) if send_status: pass if (type == 'f'): subject = "Gmooc Password Reset" message = "Click this link to reset your account: http://127.0.0.1:8000/reset/password/{0}.".format( code) send_status = send_email(subject, message, EMAIL_FROM, [email]) if send_status: pass
def send_register_email(email, send_type='register'): """先保存到数据库,方便发送后比对""" email_record = EmailVerifyRecord() random_str = generate_random_str(16) email_record.code = random_str email_record.email = email email_record.send_type = send_type email_record.save() email_title = '' email_body = '' if send_type == 'register': email_title = "慕学在线网注册激活链接" email_body = "请点击下面链接激活你的账号:http://127.0.0.2:8000/active/{0}".format( random_str) send_status = send_mail(email_title, email_body, EMAIL_FROM, [email]) if send_status: pass elif send_type == "forget": email_title = "慕学在线网密码重置链接" email_body = "请点击下面链接重置账号密码:http://127.0.0.2:8000/reset/{0}".format( random_str) send_status = send_mail(email_title, email_body, EMAIL_FROM, [email]) if send_status: pass
def send_register_email(email, send_type='register'): email_record = EmailVerifyRecord() code = random_str(16) email_record.code = code email_record.email = email email_record.send_type = send_type email_record.save() if send_type == 'register': email_title = '何佳豪个人站点激活链接' email_body = '请点击下面的链接激活你的账号:http://www.hjhgo.cn/active/{0}'.format( code) send_status = send_mail(email_title, email_body, EMAIL_FROM, [email]) if send_status: # TODO print('发送成功') elif send_type == 'forget': email_title = '何佳豪个人站点密码重置链接' email_body = '请点击下面的链接重置你的密码:http://www.hjhgo.cn/reset/{0}'.format( code) send_status = send_mail(email_title, email_body, EMAIL_FROM, [email]) if send_status: # TODO 提示发送成功 pass
def send_email(receive_name, email, send_type="comment"): random_str = generate_code(4) if send_type == "comment": random_str = generate_code(4) if send_type == "comment": email_title = "Diomedes博客评论-验证邮箱,验证码:{0}".format(random_str) email_content = "您的验证码是:{0}".format(random_str) email_body = loader.render_to_string( 'emailMessage.html', { 'base_url': 'https://blog.coderap.com', 'receive_name': receive_name, 'email_context': email_content }) message = EmailMessage(email_title, email_body, EMAIL_FROM, [email]) message.content_subtype = "html" # Main content is now text/html send_status = message.send() if int(send_status) == 1: # 保存验证码 email_record = EmailVerifyRecord() email_record.code = random_str email_record.email = email email_record.send_type = send_type email_record.send_time = datetime.utcnow() email_record.save() return int(send_status) else: return 0
def send_register_email(email, send_type="register"): email_record = EmailVerifyRecord() if send_type == "update_email": code = random_str(4) else: code = random_str(16) email_record.code = code email_record.email = email email_record.send_type = send_type email_record.save() email_title = "" email_body = "" if send_type == "register": email_title = "在线网注册激活链接" email_body = "请点击下面的链接激活你的账号: http://127.0.0.1:8000/active/{0}".format(code) send_status = send_mail(email_title, email_body, EMAIL_FROM, [email]) if send_status: pass elif send_type == "forget": email_title = "在线网注册密码重置链接" email_body = "请点击下面的链接重置密码: http://127.0.0.1:8000/reset/{0}".format(code) send_status = send_mail(email_title, email_body, EMAIL_FROM, [email]) if send_status: pass elif send_type == "update_email": email_title = "在线邮箱修改验证码" email_body = "你的邮箱验证码为: {0}".format(code) send_status = send_mail(email_title, email_body, EMAIL_FROM, [email]) if send_status: pass
def send_register_email(email, send_type='restart'): '''发送注册邮件''' email_record = EmailVerifyRecord() # 生成随机的code放入链接 code = random_str(16) email_record.code = code email_record.email = email email_record.send_type = send_type email_record.save() # 定义邮件内容 email_title = "" email_body = "" if send_type == "register": email_title = "注册链接" email_body = "请点击下面的链接激活你的账号: http://127.0.0.1:8000/user/active/{0}".format( code) # 使用Django内置函数完成邮件发送。四个参数:主题,邮件内容,发件人邮箱地址,收件人(是一个字符串列表) send_status = send_mail(email_title, email_body, EMAIL_FROM, [email]) # 如果发送成功 if send_status: pass if send_type == "restart": email_title = "重置密码链接" email_body = "请点击下面的链接重置你的密码 : http://127.0.0.1:8000/user/active/{0}".format( code) # 发送邮件 send_status = send_mail(email_title, email_body, EMAIL_FROM, [email]) if send_status: pass
def send_register_email( email: str, send_type='register', ): email_record = EmailVerifyRecord() code = random_str(random_length=16) email_record.code = code email_record.email = email email_record.send_type = send_type email_record.save() to_email = email if send_type == 'register': email_title = u'博客注册激活' email_content = u'请点击下方链接进行激活:http:127.0.0.1:8000/user/active/{0}'.format( code) send_mail(email_title, email_content, settings.DEFAULT_FROM_EMAIL, [email]) if send_type == 'forget': email_title = u'博客密码重置' email_content = u'请点击下方链接进行重置:http:127.0.0.1:8000/user/reset/{0}'.format( code) send_mail(email_title, email_content, settings.DEFAULT_FROM_EMAIL, [email])
def send_register_email(email, send_type='restart'): """发送注册邮件""" email_record = EmailVerifyRecord() # 生成随机的code放入链接 code = random_str(16) email_record.code = code email_record.email = email email_record.send_type = send_type email_record.save() # 定义邮件内容 email_title = '' email_body = '' if send_type == 'register': email_title = '注册链接' email_body = '请点击下面的链接激活你的账号: http://127.0.0.1:8000/user/active/{0}'.format( code) # 使用Django内置的函数完成邮件发送,四个参数:主题,邮件内容,发件人邮箱地址,收件人(是一个字符串列表) send_status = send_mail(email_title, email_body, EMAIL_FROM, [email]) # 如果发送成 if send_status: pass if send_type == 'restart': email_title = '重置密码链接' email_body = '请点击下面的链接重置你的密码: http://127.0.0.1:8000/user/active/{0}'.format( code) # 使用Django内置的函数完成邮件发送,四个参数:主题,邮件内容,发件人邮箱地址,收件人(是一个字符串列表) send_status = send_mail(email_title, email_body, EMAIL_FROM, [email]) # 如果发送成 if send_status: pass
def send_register_eamil(email, send_type="register"): # 发送之前先保存到数据库,到时候查询链接是否存在 # 实例化一个EmailVerifyRecord对象 email_record = EmailVerifyRecord() # 生成随机的code放入链接 if send_type == "update_email": code = random_str(4) else: code = random_str(16) email_record.code = code email_record.email = email email_record.send_type = send_type email_record.save() # 定义邮件内容: email_title = "" email_body = "" if send_type == "register": email_title = "FinX 注册激活链接" #email_body = "欢迎注册exchangeNJU: 请点击下面的链接激活你的账号: http://127.0.0.1:8000/active/{0}".format(code) email_body = loader.render_to_string( "email_register.html", # 需要渲染的html模板 { "active_code": code # 参数 }) msg = EmailMessage(email_title, email_body, EMAIL_FROM, [email]) msg.content_subtype = "html" send_status = msg.send() # 使用Django内置函数完成邮件发送。四个参数:主题,邮件内容,从哪里发,接受者list #send_status = send_mail(email_title, email_body, EMAIL_FROM, [email]) # 如果发送成功 if send_status: pass elif send_type == "forget": email_title = "FinX 找回密码链接" #email_body = "欢迎注册exchangeNJU: 请点击下面的链接激活你的账号: http://127.0.0.1:8000/reset/{0}".format(code) email_body = loader.render_to_string( "email_forget.html", # 需要渲染的html模板 { "active_code": code # 参数 }) msg = EmailMessage(email_title, email_body, EMAIL_FROM, [email]) msg.content_subtype = "html" send_status = msg.send() elif send_type == "update_email": email_title = "FinX 修改邮箱验证码" email_body = loader.render_to_string( "email_update_email.html", # 需要渲染的html模板 { "active_code": code # 参数 }) msg = EmailMessage(email_title, email_body, EMAIL_FROM, [email]) msg.content_subtype = "html" send_status = msg.send()
def send_register_eamil(email, send_type="register"): # 发送之前先保存到数据库,到时候查询链接是否存在 # 实例化一个EmailVerifyRecord对象 email_record = EmailVerifyRecord() # 生成随机的code放入链接 if send_type == "update_email": code = random_str(4) else: code = random_str(16) email_record.code = code email_record.email = email email_record.send_type = send_type email_record.save() # 定义邮件内容: email_title = "" email_body = "" if send_type == "register": email_title = " funny小站 注册激活链接" email_body = loader.render_to_string( "user/email_register.html", # 需要渲染的html模板 { "active_code": code # 参数 }) msg = EmailMessage(email_title, email_body, EMAIL_FROM, [email]) msg.content_subtype = "html" send_status = msg.send() # 使用Django内置函数完成邮件发送。四个参数:主题,邮件内容,从哪里发,接受者list # send_status = send_mail(email_title, email_body, EMAIL_FROM, [email]) elif send_type == "forget": email_title = "funny小站 找回密码链接" email_body = loader.render_to_string( "user/email_forget.html", # 需要渲染的html模板 { "active_code": code # 参数 }) msg = EmailMessage(email_title, email_body, EMAIL_FROM, [email]) msg.content_subtype = "html" send_status = msg.send() elif send_type == "update_email": email_title = "mtianyan慕课小站 修改邮箱验证码" email_body = loader.render_to_string( "email_update_email.html", # 需要渲染的html模板 { "active_code": code # 参数 }) msg = EmailMessage(email_title, email_body, EMAIL_FROM, [email]) msg.content_subtype = "html" send_status = msg.send() # 如果发送成功 return send_status
def send_code_email(email, referee_email='', send_type="register", real_name='', is_artist=False): """ :param is_artist: check the register is for artist or not :param referee_email: the email of referee's email :param real_name: the real name of user when verify as artist :param email: the email address used for sending email :param send_type: retrieve or verification :return: True/False """ email_record = EmailVerifyRecord() # store these info into database code = random_str(16) while models.EmailVerifyRecord.objects.filter(code=code): code = random_str(16) email_record.code = code email_record.email = email email_record.send_type = send_type email_record.send_time = datetime.datetime.now() email_record.save() if send_type == "register": if is_artist: email_title = "register verification for " + real_name email_body = "Register email is {registered_email}, use the blow link to activate {artist}'s " \ "account: http://127.0.0.1:8000/active/{random_code}".format(random_code=code, artist=real_name, registered_email=email) send_status = send_mail(email_title, email_body, settings.EMAIL_FROM, [referee_email]) else: email_title = "register verification" email_body = "use the blow link to activate your account: http://127.0.0.1:8000/active/{0}".format( code) send_status = send_mail(email_title, email_body, settings.EMAIL_FROM, [email]) if not send_status: return False if send_type == "reset": email_title = "reset password" email_body = "The retrieve password link is: http://127.0.0.1:8000/reset/{0}".format( code) send_status = send_mail(email_title, email_body, settings.EMAIL_FROM, [email]) if not send_status: return False return True
def send_register_eamil(email, send_type="register"): # 发送之前先保存到数据库,到时候查询链接是否存在 # 实例化一个EmailVerifyRecord对象 email_record = EmailVerifyRecord() # 生成随机的code放入链接 if send_type == 'update_email': code = random_str(4) else: code = random_str(16) email_record.code = code email_record.email = email email_record.send_type = send_type email_record.save() # 定义邮件内容: email_title = "" email_body = "" if send_type == "register": email_title = f"注册激活链接" email_body = f"请点击下面的链接激活你的账号: http://127.0.0.1:8000/active/{code}" # 使用Django内置函数完成邮件发送。四个参数:主题,邮件内容,从哪里发,接受者list send_status = send_mail(email_title, email_body, EMAIL_FROM, [email]) # 如果发送成功 if send_status: pass elif send_type == "forget": email_title = "NBA找回密码链接" email_body = f"请点击下面的链接找回你的密码: http://127.0.0.1:8000/reset/{code}" # 使用Django内置函数完成邮件发送。四个参数:主题,邮件内容,从哪里发,接受者list send_status = send_mail(email_title, email_body, EMAIL_FROM, [email]) # 如果发送成功 if send_status: pass elif send_type == "update_email": email_title = "NBA邮箱修改验证码" email_body = f"你的邮箱验证码为{code}" # 使用Django内置函数完成邮件发送。四个参数:主题,邮件内容,从哪里发,接受者list send_status = send_mail(email_title, email_body, EMAIL_FROM, [email]) # 如果发送成功 if send_status: pass
def send_register_email(email, send_type="register"):#根据注册类型: 注册or找回密码来判断发哪种邮件 email_record = EmailVerifyRecord()#每次发邮件记录都记录在EmailVerifyRecord的模型中,用于激活时判断是否有 code = random_str(16) email_record.code = code email_record.email = email email_record.send_type = send_type email_record.save() email_title = "" email_body = "" if send_type == "register": # 根据send_type定制发送内容 email_title = "天天生鲜后台在线系统激活链接" email_body = "天天生鲜后台在线系统激活链接: http://127.0.0.1:8000/user/active/{}".format(code) send_status = send_mail(email_title, email_body, settings.EMAIL_FROM, [email,]) if send_status: pass
def send_email(email, send_type='register'): #发送之前先保存到数据库,到时候查询连接是否存在 #实例化一个EmailVerifyRecord 对象 email_record = EmailVerifyRecord() #生成随机的code放入链接 code = random_str(16) email_record.code = code email_record.email = email email_record.send_type = send_type email_record.save() #定义邮箱内容 email_title = "" email_body = "" if send_type == 'register': #如果发送类型为注册 email_title = "慕学注册激活链接" email_body = "请点击下面的链接激活您的账号:http://127.0.0.1:8000/active/{0}".format( code) # 使用Django内置函数完成邮件发送。四个参数:主题,邮件内容,发件人邮箱地址,收件人(是一个字符串列表) send_status = send_mail(email_title, email_body, EMAIL_FROM, [email]) if send_status: #如果发送成功 pass elif send_type == 'forget': email_title = "慕学找回密码链接" email_body = "请点击下面的链接找回您的密码:http://127.0.0.1:8000/reset/{0}".format( code) send_status = send_mail(email_title, email_body, EMAIL_FROM, [email]) if send_status: pass elif send_type == 'update_email': #如果发送类型为重置邮箱 email_title = "慕学邮箱修改链接" email_body = "请点击下面的链接修改您的邮箱:http://127.0.0.1:8000/reset/{0}".format( code) # 使用Django内置函数完成邮件发送。四个参数:主题,邮件内容,发件人邮箱地址,收件人(是一个字符串列表) send_status = send_mail(email_title, email_body, EMAIL_FROM, [email]) if send_status: #如果发送成功 pass
def send_register_email(email, send_type='register'): email_record = EmailVerifyRecord() code = random_str(16) email_record.code = code email_record.email = email email_record.send_type = send_type email_record.save() if send_type == 'register': email_title = '注册激活链接' email_body = '点击下面的链接激活你的账号:{0}/user/active/{1}\n(30分钟内有效)'.format(REQUEST_URL,code) send_status = send_mail(email_title, email_body, EMAIL_HOST_USER, [email]) return send_status elif send_type == 'forget': email_title = '重置密码' email_body = '点击下面的链接重置密码:{0}/user/reset/{1}\n(30分钟内有效)'.format(REQUEST_URL,code) send_status = send_mail(email_title, email_body, EMAIL_HOST_USER, [email]) return send_status
def sendemail(email, send_type="register"): # 发送验证码 code = random_str(4) email_record = EmailVerifyRecord() email_record.code = code email_record.email = email email_record.send_type = send_type email_record.save() email_title = "" email_body = "" if send_type == "register": email_title = "众筹网注册激活链接" email_body = "请点击下面的链接激活你的账号: http://127.0.0.1:8000/active/{0}".format( code) send_status = send_mail(email_title, email_body, EMAIL_FROM, [email]) if send_status: pass elif send_type == "forget": email_title = "众筹网密码重置链接" email_body = "请点击下面的链接重置密码: http://127.0.0.1:8000/reset/{0}".format( code) send_status = send_mail(email_title, email_body, EMAIL_FROM, [email]) if send_status: pass elif send_type == "update_email": email_title = "众筹网邮箱修改验证码" email_body = "你的邮箱验证码为: {0}".format(code) send_status = send_mail(email_title, email_body, EMAIL_FROM, [email]) if send_status: pass elif send_type == "realname_certify": email_title = "众筹网邮箱实名认证验证码" email_body = "你的邮箱验证码为:{0}".format(code) send_status = send_mail(email_title, email_body, EMAIL_FROM, [email]) if send_status: return True
def send_register_email(email, send_type="register"): email_record = EmailVerifyRecord() # 将给用户发的信息保存在数据库中 code = random_str(16) email_record.code = code email_record.email = email email_record.send_type = send_type email_record.save() # 初始化为空 email_title = "" email_body = "" # 如果为注册类型 if send_type == "register": email_title = "注册激活链接" email_body = "请点击下面的链接激活你的账号: http://127.0.0.1:8000/user/active/{0}".format( code) # 发送邮件 send_status = send_mail(email_title, email_body, EMAIL_FROM, [email]) if send_status: pass
def send_reg_email(email, send_type='register'): email_record = EmailVerifyRecord() code = random_str(16) email_record.email = email email_record.code = code email_record.send_type = send_type email_record.save() if send_type == 'register': email_title = "二大爷注册" email_body = "请点击下面的链接激活你的账号:http://127.0.0.1:8000/active/{0}".format( code) # send_status=send_mail(email_title,email_body,EMAIL_FROM,[email]) # if send_status: # pass html_content = loader.render_to_string("login/email.html", {}) msg = EmailMessage(email_title, html_content, EMAIL_FROM, [email]) msg.content_subtype = "html" msg.send()
def send_register_email(email, send_type='register'): # 在数据库生成邮箱激活码记录 email_record = EmailVerifyRecord() code = random_str(4 if send_type == 'update_email' else 16) email_record.code = code email_record.email = email email_record.send_type = send_type email_record.save() # 定义邮箱发送内容 email_title = '' email_body = '' send_url = 'http://127.0.0.1/' if send_type == 'register': email_title = 'iMooc在线, 注册新用户, 激活链接' email_body = '请点击下边的连接激活你的账号: {0}active/{1}'.format(send_url, code) # 调用django内置的邮件发送函数 send_status = send_mail(email_title, email_body, EMAIL_FROM, [email]) if send_status: return '已经发送邮箱, 请查看邮件激活账户' elif send_type == 'forget': email_title = 'iMooc在线, 个人账户密码, 重置链接' email_body = '请点击下边的连接重置你的密码: {0}reset/{1}'.format(send_url, code) send_status = send_mail(email_title, email_body, EMAIL_FROM, [email]) if send_status: pass elif send_type == 'update_email': """ 修改邮箱 """ email_title = 'iMooc在线, 账户绑定新邮箱, 验证码' email_body = '{0}'.format(code) send_status = send_mail(email_title, email_body, EMAIL_FROM, [email]) if send_status: pass
def send_register_email(email, send_type): email_record = EmailVerifyRecord() code = random_str(16) email_record.code = code email_record.email = email email_record.send_type = send_type email_record.save() email_title = "" email_body = "" if send_type == "register": email_title = "慕学在线网注册激活链接" email_body = "请点击下面链接激活您的帐号:http://127.0.0.1:8000/active/{0}".format( code) send_mail(email_title, email_body, EMAIL_FROM, [email]) if send_type == "forget": usr_msg = models.UserProfile.objects.filter(username=email) for usr in usr_msg: pwd = usr.password email_title = "慕学在线网注册激活链接" email_body = "http://127.0.0.1:8000/user/reset/{0}".format(code) send_mail(email_title, email_body, EMAIL_FROM, [email])
def send_email(email_info, email, send_type="comment"): if send_type == "comment": random_str = generate_code(4) email_title = "Diomedes博客评论-验证邮箱,验证码:{0}".format(random_str) context = { 'email_info': { 'base_url': SITE_BASE_URL, 'receive_name': email_info['receive_name'], 'code': random_str } } email_body = loader.render_to_string('CommentCodeEmail.html', context) message = EmailMessage(email_title, email_body, EMAIL_FROM, [email]) message.content_subtype = "html" # Main content is now text/html send_status = message.send() if int(send_status) == 1: # 保存验证码 email_record = EmailVerifyRecord() email_record.code = random_str email_record.email = email email_record.send_type = send_type email_record.send_time = datetime.utcnow() email_record.save() return int(send_status) else: return 0 if send_type == 'reply_comment': email_title = "Diomedes博客评论-收到回复" context = { 'email_info': email_info } email_body = loader.render_to_string('ReplyCommentEmail.html', context) message = EmailMessage(email_title, email_body, EMAIL_FROM, [email]) message.content_subtype = "html" # Main content is now text/html return message.send()
def send_register_email(email, send_type="register"): code = random_str(16) email_title = "喝酒不叫我---注册" email_record = EmailVerifyRecord() email_record.code = code email_record.email = email email_record.send_type = send_type email_record.save() if send_type == 'register': email_body = "请点击下面的链接激活你的账号: http://127.0.0.1:8000/active/{0}".format( code) elif send_type == 'forget': email_body = "请点击下面的链接修改你的密码: http://127.0.0.1:8000/active/{0}".format( code) try: send_status = send_mail(email_title, email_body, EMAIL_FROM, [email]) if send_status: return True except Exception as e: print(e) return False
def send_register_email(email, send_type='register'): code = make_random_str(16) email_record = EmailVerifyRecord() email_record.code = code email_record.email = email email_record.send_type = send_type email_record.save() if send_type == 'register': email_title = '在线教育网站注册激活链接' email_body = '请点击下面的链接激活你的账号: http://127.0.0.1:8000/active/{}'.format( code) send_status = send_mail(email_title, email_body, EMAIL_FROM, [email]) if send_status: pass elif send_type == 'forget': email_title = '在线教育网站密码重置链接' email_body = '请点击下面的链接重置密码: http://127.0.0.1:8000/reset/{}'.format( code) send_status = send_mail(email_title, email_body, EMAIL_FROM, [email]) if send_status: pass
def send_email(email, send_type='register'): """ 发送电子邮件 :param email: :param send_type: :return: """ verify_code = EmailVerifyRecord() if send_type == 'upd_email': verify_code.code = random_str(4) else: verify_code.code = random_str(16) verify_code.email = email verify_code.send_type = send_type verify_code.save() if send_type == 'register': email_title = "在线学校网激活链接" email_body = "请点击下面的链接激活你的帐号:http://127.0.0.1:8000/account/active/{0}".format( verify_code.code) send_status = send_mail(email_title, email_body, EMAIL_FROM, [email]) if send_status: print("发送注册激活邮件成功") elif send_type == 'forget': email_title = '在线学校网网密码重置链接' email_body = '请点击下面的链接重置你的密码:http://127.0.0.1:8000/account/reset/{0}'.format( verify_code.code) send_status = send_mail(email_title, email_body, EMAIL_FROM, [email]) if send_status: print("发送重置密码邮件成功") elif send_type == 'upd_email': email_title = '在线学校网修改邮箱验证码' email_body = '你的邮箱验证码为:{0}'.format(verify_code.code) send_status = send_mail(email_title, email_body, EMAIL_FROM, [email]) if send_status: print("发送修改密码验证邮件成功")
def send_register_email(email, send_type='register'): email_record = EmailVerifyRecord() if send_type == 'update_email': email_record.code = generate_random_str(4) else: email_record.code = generate_random_str(16) email_record.email = email email_record.send_type = send_type email_record.save() email_title = '' email_body = '' if send_type == 'register': email_title = 'Mxonline注册激活链接' email_body = '请点击以下链接激活你的账号:http://127.0.0.1:8000/active/{0}'.format( email_record.code) send_status = send_mail(email_title, email_body, EMAIL_FROM, [email]) if send_status: print('ss') if send_type == 'forget': email_title = 'Mxonline密码重置链接' email_body = '请点击以下链接修改你的密码:http://127.0.0.1:8000/reset/{0}'.format( email_record.code) send_status = send_mail(email_title, email_body, EMAIL_FROM, [email]) if send_status: print('ss') if send_type == 'update_email': email_title = 'Mxonline邮箱修改链接' email_body = '你的邮箱验证码为:{0}'.format(email_record.code) send_status = send_mail(email_title, email_body, EMAIL_FROM, [email]) if send_status: print('ss')