从博客向收件人发送邮件时出现错误,但会引发错误。
@app.route('/contact', methods=['GET', 'POST'])
def contact():
if request.method == 'POST':
name = request.form.get ('name')
email = request.form.get('email')
phone = request.form.get('phone')
message = request.form.get('message')
entry = Contact(name=name, email=email, phone_no=phone, \
date=datetime.now(), message=message)
db.session.add(entry)
db.session.commit()
mail.send_message('A message from Blog' + name,
sender=email,
recepients=params['gail-user'],
body=message + "/n" + phone
)
return render_template('contact.html',params=params)
答案 0 :(得分:0)
和the argument一词的拼写是recipients
,而不是recepients
。 flask-mail的Message
类型(send_message
与参数匹配)需要正确的拼写。