Ich benutze Kolben + socketio mit ssl, und ich versuche, Mail zu senden, aber aus irgendeinem Grund funktioniert das Senden von E-Mails nicht.flask_mail, Mails sind auf Thread fest und werden nie gesendet
Hier ist meine Konfiguration:
app.config['MAIL_SERVER']='smtp.gmail.com'
app.config['MAIL_PORT'] = 465
app.config['MAIL_USERNAME'] = '[email protected]'
app.config['MAIL_PASSWORD'] = 'xxx;'
app.config['MAIL_USE_TLS'] = False
app.config['MAIL_USE_SSL'] = True
app.config['DEBUG'] = True
mail=Mail(app)
...
Und wenn ich verwende es:
@app.route('/testMail')
def testMail():
msg = Message(
'Hello',
sender='[email protected]',
recipients=['[email protected]'])
msg.body = "This is the email body"
mail.send(msg)
return ""
Und hier das Fehlerprotokoll:
File "/usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib/python2.7/socket.py", line 307, in flush self._sock.sendall(view[write_offset:write_offset+buffer_size]) File "/usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib/python2.7/ssl.py", line 721, in sendall v = self.send(data[count:]) File "/usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib/python2.7/ssl.py", line 687, in send v = self._sslobj.write(data) error: [Errno 32] Broken pipe
...
File "/usr/local/lib/python2.7/site-packages/flask_mail.py", line 156, in configure_host host = smtplib.SMTP_SSL(self.mail.server, self.mail.port) File "/usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib/python2.7/smtplib.py", line 796, in init SMTP.init(self, host, port, local_hostname, timeout) File "/usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib/python2.7/smtplib.py", line 256, in init (code, msg) = self.connect(host, port) File "/usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib/python2.7/smtplib.py", line 316, in connect self.sock = self._get_socket(host, port, self.timeout) File "/usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib/python2.7/smtplib.py", line 801, in _get_socket new_socket = socket.create_connection((host, port), timeout) File "/usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib/python2.7/socket.py", line 575, in create_connection raise err error: [Errno 65] No route to host
Aus irgendwelchen Gründen kann ich keine senden Email. Es scheint wegen der socketio + ssl Wrapping fest. Also habe ich keine Ahnung, bekam wie man die richtige Art und Weise konfigurieren
Es gibt keine Route zum Host im Fehlerprotokoll. Überprüfen Sie die Netzwerkverbindung zum Server und Port von Ihrem Programm. Dies kann durch eine Firewall verhindert werden. – VPfB