models.py 文件源码

python
阅读 22 收藏 0 点赞 0 评论 0

项目:LIMS-Backend 作者: LeafLIMS 项目源码 文件源码
def send_email(self):
        if self.code and self.account:
            subject = '{from_name} user account access code'.format(from_name=settings.EMAIL_FROM)
            message = '''Dear {first} {last},\n
You are receiveing this email as you have asked to reset a part of your account.\n
Please input the following code when asked: {code}\n
Thank you,\n
{from_name}'''.format(first=self.account.first_name,
                      last=self.account.last_name,
                      code=self.code,
                      from_name=settings.EMAIL_FROM)
            try:
                send_mail(subject,
                          message,
                          settings.EMAIL_HOST_USER,
                          (self.account.email,),
                          fail_silently=False)
            except smtplib.SMTPException:
                return False
            return True
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号