Exemplo n.º 1
0
def create_account_activation_msg(toaddr, token):
    """(string, string) -> string
    Create the email headers/body of an account activation email.
    """
    d = {
            "from": config['app_conf']['email_from'],
            "to": toaddr,
            "date":  datetime.datetime.now().ctime(),
            "appname": config['app_conf']['site_name'],
            "activate_url": h.url_for(controller='account', action='activate',
                id=token, qualified=True),
            "cancel_url": h.url_for(controller='account', action='cancel_account',
                id=token, qualified=True)
        }

    msg = """From: %(from)s
To: %(to)s
Date: %(date)s
Subject: [%(appname)s] account activation.

Somebody, probably you, created a %(appname)s account for your address
%(to)s.

To activate your account, go to %(activate_url)s .

To cancel the account, please go to %(cancel_url)s .
""" % d
    msg = msg.replace('\n', '\r\n')

    return msg
Exemplo n.º 2
0
def create_password_reset_msg(toaddr, token):
    """(string, string) -> string
    Create the email headers/body of a password reset email.
    """
    d = {
            "from": config['app_conf']['email_from'],
            "to": toaddr,
            "date":  datetime.datetime.now().ctime(),
            "appname": config['app_conf']['site_name'],
            "reset_url": h.url_for(controller='account', action='reset',
                id=token, qualified=True),
            "cancel_url": h.url_for(controller='account', action='cancel_reset',
                id=token, qualified=True)
        }

    msg = """From: %(from)s
To: %(to)s
Date: %(date)s
Subject: [%(appname)s] password reset.

Somebody, probably you, requested a password reset for your %(appname)s account
%(to)s.

To reset your password, go to %(reset_url)s .

To cancel the request, please go to %(cancel_url)s .
""" % d
    msg = msg.replace('\n', '\r\n')

    return msg
Exemplo n.º 3
0
def create_account_activation_msg(toaddr, token):
    """(string, string) -> string
    Create the email headers/body of an account activation email.
    """
    d = {
        "from":
        config['app_conf']['email_from'],
        "to":
        toaddr,
        "date":
        datetime.datetime.now().ctime(),
        "appname":
        config['app_conf']['site_name'],
        "activate_url":
        h.url_for(controller='account',
                  action='activate',
                  id=token,
                  qualified=True),
        "cancel_url":
        h.url_for(controller='account',
                  action='cancel_account',
                  id=token,
                  qualified=True)
    }

    msg = """From: %(from)s
To: %(to)s
Date: %(date)s
Subject: [%(appname)s] account activation.

Somebody, probably you, created a %(appname)s account for your address
%(to)s.

To activate your account, go to %(activate_url)s .

To cancel the account, please go to %(cancel_url)s .
""" % d
    msg = msg.replace('\n', '\r\n')

    return msg
Exemplo n.º 4
0
def create_password_reset_msg(toaddr, token):
    """(string, string) -> string
    Create the email headers/body of a password reset email.
    """
    d = {
        "from":
        config['app_conf']['email_from'],
        "to":
        toaddr,
        "date":
        datetime.datetime.now().ctime(),
        "appname":
        config['app_conf']['site_name'],
        "reset_url":
        h.url_for(controller='account',
                  action='reset',
                  id=token,
                  qualified=True),
        "cancel_url":
        h.url_for(controller='account',
                  action='cancel_reset',
                  id=token,
                  qualified=True)
    }

    msg = """From: %(from)s
To: %(to)s
Date: %(date)s
Subject: [%(appname)s] password reset.

Somebody, probably you, requested a password reset for your %(appname)s account
%(to)s.

To reset your password, go to %(reset_url)s .

To cancel the request, please go to %(cancel_url)s .
""" % d
    msg = msg.replace('\n', '\r\n')

    return msg