this is the code form init.py:
#mail configuration
app.config['MAIL_SERVER'] : 'smtp-mail.outlook.com'
app.config['MAIL_PORT'] : 587
app.config['MAIL_USE_TLS'] : False
app.config['MAIL_USE_SSL'] : True
app.config['MAIL_USERNAME'] : 'user'
app.config['MAIL_PASSWORD'] : 'passwd'
app.config['MAIL_DEBUG'] : False
mail = Mail(app)
the route code that handles the Post from the form:
@app.route('/contact', methods=['POST'])
def contact():
if request.method == 'POST':
name = request.form['name']
email = request.form['email']
subject = request.form['subject']
message = request.form['message']
msg = Message(subject=subject,
recipients=['rec'],
sender='sender',
body=f'message from : {name} \n email : {email} \n\n\n {message}')
mail.send(msg)
the error :
ConnectionRefusedError: [WinError 10061] No connection could be made because the target machine actively refused it
any ideas please