def index(): msg = Message("hello", sender="*****@*****.**", recipients=["*****@*****.**"]) msg.body = "testing" msg.html = "<b>testing</b>" mail.send(msg) return 'ok'
def send_status_email(ticket): # send an email regarding ticket status. This needs to be set up with a mail server. msg = Message("CLiCC Tool Result Status", sender=("no-reply","no-reply")) msg.body = """Hello, the results of {0}, ticket {1}, have returned with a status of {2}. Please submit your ticket number for more information.""".format(ticket['smiles'], ticket['number'], ticket['status']) msg.add_recipient(ticket['email']) mail.send(msg)
def recuperar_pass(usuario_id): if (usuario_id != "" and usuario_id.isdigit()): usuario_email = Usuario.get(Usuario.id == usuario_id).email nuevo_pass = str(time.time())[0:5] usuario_recuperado = Usuario.update(password=md5(nuevo_pass).hexdigest())\ .where(Usuario.id == usuario_id) usuario_recuperado.execute() confirmacion = Message("Recuperar ContraseƱa", sender=("Sistema", "*****@*****.**"), recipients=[usuario_email]) confirmacion.body = "Su nueva contraseƱa es: %s" % nuevo_pass mail.send(confirmacion) return redirect(url_for("home")) else: abort(406)
def registration(user): msg = Message("Registration at %s" % app.config["DOMAIN"], sender=get_sender()) msg.add_recipient(user.default_email.email) msg.body = render_template("mails/registration.txt", user=user) send(msg)
def send_mail(subject, recipients, html_body, text_body=None): msg = Message(subject=subject, recipients=recipients, charset='utf-8') if text_body: msg.body = text_body msg.html = html_body mail.send(msg)