email.py 文件源码

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

项目:picoCTF 作者: picoCTF 项目源码 文件源码
def send_email_invite(gid, email, teacher=False):
    """
    Sends an email registration link that will automatically join into a group. This link will bypass the email filter.
    """

    group = api.group.get_group(gid=gid)

    token_value = api.token.set_token({"gid": group["gid"], "email": email, "teacher": teacher}, "registration_token")

    registration_link = "{}/#g={}&r={}".\
        format(api.config.competition_urls[0], group["gid"], token_value)

    body = """
You have been invited by the staff of the {1} organization to compete in {0}.
You will need to follow the registration link below to finish the account creation process.

If you believe this to be a mistake you can safely ignore this email.

Registration link: {2}

Good luck!
  The {0} Team.
    """.format(api.config.competition_name, group["name"], registration_link)

    subject = "{} Registration".format(api.config.competition_name)

    message = Message(body=body, recipients=[email], subject=subject)
    mail.send(message)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号