コード例 #1
0
def index():
	msg = Message("hello", sender="*****@*****.**", recipients=["*****@*****.**"])
	msg.body = "testing"
	msg.html = "<b>testing</b>"

	mail.send(msg)
	return 'ok'
コード例 #2
0
ファイル: runserver.py プロジェクト: DajeRoma/clicc-flask
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)
コード例 #3
0
ファイル: result.py プロジェクト: drewmalin/WodTag
    def create_result():
        workout_id = flask.request.form['workout_id']
        if ResultCRUD.validate_result_create(workout_id) != 0:
            return flask.redirect(flask.url_for('result_create', workout_id=workout_id))
        else:
            result = WorkoutResult()
            result.user = flask_login.current_user
            result.workout_id = workout_id
            for part in Workout.query.get(workout_id).parts:
                result_data = flask.request.form['result_'+part.order]
                result_details = flask.request.form['detail_'+part.order]
                if flask.request.form.get('pr_'+part.order, False):
                    pr = True
                else:
                    pr = False
                part_result = WorkoutPartResult(result_data)
                part_result.order = part.order
                part_result.part = part
                part_result.details = result_details
                part_result.pr = pr
                result.parts.append(part_result)
            db.session.add(result)
            db.session.commit()
            flask.flash("Successfully recorded workout!", "success")

            # Here be email code... this should be moved to a utility class
            msg = Message(flask_login.current_user.username + " just recorded a new workout result!",
                  sender=("WodTag", "*****@*****.**"))

            for follower in flask_login.current_user.followed_by:
                if follower.email is not None or follower.email != "":
                    msg.add_recipient(follower.email)

            msg.html = "<h1>" + flask_login.current_user.username + " recorded a new result:</h1>"
            msg.html += "<br />"
            msg.html += "<hr />"
            msg.html += "<h4>" + result.workout.name+ "</h4>"
            msg.html += "<table cellspacing=\"10\">"
            for result_part in result.parts:
                msg.html += "<tr>"
                msg.html += "<td><pre>" + result_part.part.description + "</pre></td>"
                msg.html += "<td style=\"vertical-align: top\"><pre>" + \
                            result_part.result + " (" + result_part.part.uom + ")</  pre></td>"
                msg.html += "<td style=\"vertical-align: top\">"
                if result_part.pr:
                    msg.html += "<pre><b>PR!</b></pre>"
                msg.html += "</td>"
                msg.html += "</tr>"
            msg.html += "</table>"
            msg.html += "<br />"
            msg.html += "<hr />"
            msg.html += "<a href=\"www.wodtag.com\">#WodTag</a>"

            mail.send(msg)
            # end email code

            return flask.redirect(flask.url_for('result', result_id=result.id))
コード例 #4
0
ファイル: main.py プロジェクト: MSA-Argentina/Drinklogger
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)
コード例 #5
0
ファイル: common.py プロジェクト: dotajin/haoku-open
def send_reset_pass_email(user, code):
	msg = Message(u'好酷网 - 找回密码',
			sender=current_app.config.get('SERVICE_EMAIL'),
			recipients=[user.email],
			charset='utf-8')
	url = current_app.config.get('RESET_EMAIL_URL')
	params = urllib.urlencode({'code':code})
	url = '%s?%s' % (url, params)
	msg.html = render_template_string(reset_pass_html, 
		username=user.username, url=url)

	if current_app.status == 'DEBUG':
		current_app.logger.info(msg.html)
	elif current_app.status == 'TEST':
		current_app.logger.info(msg.html)
		mail.send(msg)
	else:
		mail.send(msg)
コード例 #6
0
ファイル: emails.py プロジェクト: dotajin/haoku-open
def send_reset_pass_email(user, code):
	msg = Message(u'好酷网 - 找回密码',
			sender=current_app.config.get('SERVICE_EMAIL'),
			recipients=[user.email],
			charset='utf-8')
	url = current_app.config.get('RESET_EMAIL_URL')
	params = urllib.urlencode({'code':code})
	url = '%s?%s' % (url, params)
	msg.html = render_template_string(reset_pass_html, 
		username=user.username, url=url)

	if current_app.status == 'DEBUG':
		current_app.logger.info(msg.html)
	elif current_app.status == 'TEST':
		current_app.logger.info(msg.html)
		mail.send(msg)
	else:
		mail.send(msg)
コード例 #7
0
ファイル: mails.py プロジェクト: opatut/mini
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)
コード例 #8
0
ファイル: views.py プロジェクト: Leonnash21/info3180-lab3
def sendemail(to, subject, template, **kwargs):
    msg=Message(app.config['DEFAULT_MAIL_SUBJECT']+''+ subject, sender=app.config['DEFAULT_MAIL_SENDER'],recipients=[to])
    msg.html = render_template(template + '.html', **kwargs) 
    mail.sendmail(msg)
コード例 #9
0
ファイル: emails.py プロジェクト: eea/eea.seris
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)
コード例 #10
0
ファイル: mailtest.py プロジェクト: vinaych7/bitsandbytes
def index():

    msg = Message("Hello",
                  sender="*****@*****.**",
                  recipients=["*****@*****.**"])
    mail.send(msg)