Ejemplo n.º 1
0
def send_reset(user):
    if _cfg("smtp-host") == "":
        return
    smtp = smtplib.SMTP(_cfg("smtp-host"), _cfgi("smtp-port"))
    smtp.starttls()
    smtp.ehlo()
    smtp.login(_cfg("smtp-user"), _cfg("smtp-password"))
    with open("emails/reset") as f:
        message = MIMEText(
            html.parser.HTMLParser().unescape(
                pystache.render(
                    f.read(),
                    {
                        "user": user,
                        "domain": _cfg("domain"),
                        "protocol": _cfg("protocol"),
                        "confirmation": user.passwordReset,
                    },
                )
            )
        )
    message["X-MC-Important"] = "true"
    message["X-MC-PreserveRecipients"] = "false"
    message["Subject"] = "Reset your %s password" % _cfg("domain")
    message["From"] = _cfg("smtp-from")
    message["To"] = user.email
    smtp.sendmail(_cfg("smtp-from"), [user.email], message.as_string())
    smtp.quit()
Ejemplo n.º 2
0
def send_rejection(user):
    if _cfg("smtp-host") == "":
        return
    smtp = smtplib.SMTP(_cfg("smtp-host"), _cfgi("smtp-port"))
    smtp.login(_cfg("smtp-user"), _cfg("smtp-password"))
    with open("emails/reject") as f:
        message = MIMEText(f.read())
    message['X-MC-Important'] = "true"
    message['X-MC-PreserveRecipients'] = "false"
    message['Subject'] = "Your sr.ht account has been rejected"
    message['From'] = "*****@*****.**"
    message['To'] = user.email
    smtp.sendmail("*****@*****.**", [ user.email ], message.as_string())
    smtp.quit()
Ejemplo n.º 3
0
def send_rejection(user):
    if _cfg("smtp-host") == "":
        return
    smtp = smtplib.SMTP(_cfg("smtp-host"), _cfgi("smtp-port"))
    smtp.ehlo()
    smtp.starttls()
    smtp.login(_cfg("smtp-user"), _cfg("smtp-password"))
    with open("emails/reject") as f:
        message = MIMEText(f.read())
    message['Subject'] = "Your sr.ht account has been rejected"
    message['From'] = _cfg("smtp-user")
    message['To'] = user.email
    smtp.sendmail(_cfg("smtp-user"), [user.email], message.as_string())
    smtp.quit()
Ejemplo n.º 4
0
def send_rejection(user):
    if _cfg("smtp-host") == "":
        return
    smtp = smtplib.SMTP(_cfg("smtp-host"), _cfgi("smtp-port"))
    smtp.login(_cfg("smtp-user"), _cfg("smtp-password"))
    with open("emails/reject") as f:
        message = MIMEText(f.read())
    message['X-MC-Important'] = "true"
    message['X-MC-PreserveRecipients'] = "false"
    message['Subject'] = "Your sr.ht account has been rejected"
    message['From'] = "*****@*****.**"
    message['To'] = user.email
    smtp.sendmail("*****@*****.**", [user.email], message.as_string())
    smtp.quit()
Ejemplo n.º 5
0
def send_invite(user):
    if _cfg("smtp-host") == "":
        return
    smtp = smtplib.SMTP(_cfg("smtp-host"), _cfgi("smtp-port"))
    smtp.login(_cfg("smtp-user"), _cfg("smtp-password"))
    with open("emails/invite") as f:
        message = MIMEText(html.parser.HTMLParser().unescape(\
            pystache.render(f.read(), {
                'user': user,
                "domain": _cfg("domain"),
                "protocol": _cfg("protocol")
            })))
    message['X-MC-Important'] = "true"
    message['X-MC-PreserveRecipients'] = "false"
    message['Subject'] = "Your sr.ht account is approved"
    message['From'] = "*****@*****.**"
    message['To'] = user.email
    smtp.sendmail("*****@*****.**", [ user.email ], message.as_string())
    smtp.quit()
Ejemplo n.º 6
0
def send_invite(user):
    if _cfg("smtp-host") == "":
        return
    smtp = smtplib.SMTP(_cfg("smtp-host"), _cfgi("smtp-port"))
    smtp.ehlo()
    smtp.starttls()
    smtp.login(_cfg("smtp-user"), _cfg("smtp-password"))
    with open("emails/invite") as f:
        message = MIMEText(html.parser.HTMLParser().unescape(\
            pystache.render(f.read(), {
                'user': user,
                "domain": _cfg("domain"),
                "protocol": _cfg("protocol")
            })))
    message['Subject'] = "Your sr.ht account is approved"
    message['From'] = _cfg("smtp-user")
    message['To'] = user.email
    smtp.sendmail(_cfg("smtp-user"), [user.email], message.as_string())
    smtp.quit()
Ejemplo n.º 7
0
def send_request_notification(user):
    if _cfg("smtp-host") == "":
        return
    smtp = smtplib.SMTP(_cfg("smtp-host"), _cfgi("smtp-port"))
    smtp.ehlo()
    smtp.starttls()
    smtp.login(_cfg("smtp-user"), _cfg("smtp-password"))
    with open("emails/new_request") as f:
        message = MIMEText(
            html.parser.HTMLParser().unescape(
                pystache.render(f.read(), {"user": user, "domain": _cfg("domain"), "protocol": _cfg("protocol")})
            )
        )
    message["X-MC-Important"] = "true"
    message["X-MC-PreserveRecipients"] = "false"
    message["Subject"] = "New %s account request" % _cfg("domain")
    message["From"] = _cfg("smtp-from")
    message["To"] = _cfg("owner_email")
    smtp.sendmail(_cfg("smtp-from"), [_cfg("owner_email")], message.as_string())
    smtp.quit()
Ejemplo n.º 8
0
def send_reset(user):
    if _cfg("smtp-host") == "":
        return
    smtp = smtplib.SMTP(_cfg("smtp-host"), _cfgi("smtp-port"))
    smtp.login(_cfg("smtp-user"), _cfg("smtp-password"))
    with open("emails/reset") as f:
        message = MIMEText(html.parser.HTMLParser().unescape(\
            pystache.render(f.read(), {
                'user': user,
                "domain": _cfg("domain"),
                "protocol": _cfg("protocol"),
                'confirmation': user.passwordReset
            })))
    message['X-MC-Important'] = "true"
    message['X-MC-PreserveRecipients'] = "false"
    message['Subject'] = "Reset your sr.ht password"
    message['From'] = "*****@*****.**"
    message['To'] = user.email
    smtp.sendmail("*****@*****.**", [user.email], message.as_string())
    smtp.quit()
Ejemplo n.º 9
0
Archivo: email.py Proyecto: p440/sr.ht
def send_rejection(user):
    if _cfg("smtp-host") == "":
        return
    smtp = smtplib.SMTP(_cfg("smtp-host"), _cfgi("smtp-port"))
    smtp.starttls()
    smtp.ehlo()
    smtp.login(_cfg("smtp-user"), _cfg("smtp-password"))
    with open("emails/reject") as f:
        message = MIMEText(html.parser.HTMLParser().unescape(
            pystache.render(f.read(), {
                'user': user,
                "domain": _cfg("domain"),
                "protocol": _cfg("protocol")
            })))
    message['X-MC-Important'] = "true"
    message['X-MC-PreserveRecipients'] = "false"
    message['Subject'] = "Your %s account has been rejected" % _cfg("domain")
    message['From'] = _cfg("smtp-from")
    message['To'] = user.email
    smtp.sendmail(_cfg("smtp-from"), [ user.email ], message.as_string())
    smtp.quit()
Ejemplo n.º 10
0
from srht.app import app
from srht.config import _cfg, _cfgi

import os

app.static_folder = os.path.join(os.getcwd(), "static")

import os
if __name__ == '__main__':
    app.run(host=_cfg("debug-host"), port=_cfgi('debug-port'), debug=True)
Ejemplo n.º 11
0
from srht.app import app
from srht.config import _cfg, _cfgi

import os

app.static_folder = os.path.join(os.getcwd(), "static")

import os

if __name__ == "__main__":
    app.run(host=_cfg("debug-host"), port=_cfgi("debug-port"), debug=True)