Python 2.7 如何使用具有flask安全性的mandrill模块?
我可以使用mandrill模块发送安全邮件吗 我知道flask security正在使用flask邮件模块,但我想改用mandrill。使用,并使用它发送电子邮件:Python 2.7 如何使用具有flask安全性的mandrill模块?,python-2.7,flask,mandrill,flask-security,Python 2.7,Flask,Mandrill,Flask Security,我可以使用mandrill模块发送安全邮件吗 我知道flask security正在使用flask邮件模块,但我想改用mandrill。使用,并使用它发送电子邮件: from flask.ext.mandrill import Mandrill app = Flask(__name__) app.config['MANDRILL_API_KEY'] = 'your api key' app.config['MANDRILL_DEFAULT_FROM'] = 'admin@yourdomain.
from flask.ext.mandrill import Mandrill
app = Flask(__name__)
app.config['MANDRILL_API_KEY'] = 'your api key'
app.config['MANDRILL_DEFAULT_FROM'] = 'admin@yourdomain.com'
mandrill = Mandrill(app)
@security.send_mail_task
def send_email(msg):
mandrill.send_email(
from_email=msg.sender,
subject=msg.subject,
to=map(lambda recipient: {'email': recipient}, msg.recipients),
html=msg.html
)
Flask Security与Flask Mail对话以发送电子邮件,您可以使用Python 3中的Flask Sequerity codemap()作为生成器函数,它在JSON中不可序列化。将其包装在列表中可以解析:
to=list(映射(lambda收件人:{'email':recipient},msg.recipients)),html=msg.html
如何添加cc电子邮件id