这是网页上的报错。
```
# smtplib.SMTPSenderRefused
smtplib.SMTPSenderRefused: (550, b'Unauthenticated senders not allowed', '=?utf-8?q?ddwade?= <2083297662@qq.com>')
## Traceback *(most recent call last)*
* #### File "c:\users\asus\flask\helloflask\.venv\lib\site-packages\flask\app.py", line *2309* , in `__call__`
return self.wsgi_app(environ, start_response)
* #### File "c:\users\asus\flask\helloflask\.venv\lib\site-packages\flask\app.py", line *2295* , in `wsgi_app`
response = self.handle_exception(e)
* #### File "c:\users\asus\flask\helloflask\.venv\lib\site-packages\flask\app.py", line *1741* , in `handle_exception`
reraise(exc_type, exc_value, tb)
* #### File "c:\users\asus\flask\helloflask\.venv\lib\site-packages\flask\_compat.py", line *35* , in `reraise`
![](http://localhost:5000/?__debugger__=yes&cmd=resource&f=console.png)raise value
* #### File "c:\users\asus\flask\helloflask\.venv\lib\site-packages\flask\app.py", line *2292* , in `wsgi_app`
response = self.full_dispatch_request()
* #### File "c:\users\asus\flask\helloflask\.venv\lib\site-packages\flask\app.py", line *1815* , in `full_dispatch_request`
rv = self.handle_user_exception(e)
* #### File "c:\users\asus\flask\helloflask\.venv\lib\site-packages\flask\app.py", line *1718* , in `handle_user_exception`
reraise(exc_type, exc_value, tb)
* #### File "c:\users\asus\flask\helloflask\.venv\lib\site-packages\flask\_compat.py", line *35* , in `reraise`
raise value
* #### File "c:\users\asus\flask\helloflask\.venv\lib\site-packages\flask\app.py", line *1813* , in `full_dispatch_request`
rv = self.dispatch_request()
* #### File "c:\users\asus\flask\helloflask\.venv\lib\site-packages\flask\app.py", line *1799* , in `dispatch_request`
return self.view_functions[rule.endpoint](**req.view_args)
* #### File "C:\Users\ASUS\flask\helloflask\demos\email\app.py", line *97* , in `index`
send_smtp_mail(subject, to, body)
* #### File "C:\Users\ASUS\flask\helloflask\demos\email\app.py", line *39* , in `send_smtp_mail`
mail.send(message)
* #### File "c:\users\asus\flask\helloflask\.venv\lib\site-packages\flask_mail.py", line *492* , in `send`
message.send(connection)
* #### File "c:\users\asus\flask\helloflask\.venv\lib\site-packages\flask_mail.py", line *427* , in `send`
connection.send(self)
* #### File "c:\users\asus\flask\helloflask\.venv\lib\site-packages\flask_mail.py", line *192* , in `send`
message.rcpt_options)
* #### File "d:\py3.7\Lib\smtplib.py", line *867* , in `sendmail`
raise SMTPSenderRefused(code, resp, from_addr)
> smtplib.SMTPSenderRefused: (550, b'Unauthenticated senders not allowed', '=?utf-8?q?ddwade?= <2083297662@qq.com>')
这应该是终端和sendgrid的交互信息
* Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)
127.0.0.1 - - [06/Jun/2019 14:22:41] "POST / HTTP/1.1" 200 -
127.0.0.1 - - [06/Jun/2019 14:22:41] "GET /static/favicon.ico HTTP/1.1" 200 -
send: 'ehlo [100.64.126.4]\r\n'
reply: b'250-smtp.sendgrid.net\r\n'
reply: b'250-8BITMIME\r\n'
reply: b'250-PIPELINING\r\n'
reply: b'250-SIZE 31457280\r\n'
reply: b'250-STARTTLS\r\n'
reply: b'250-AUTH PLAIN LOGIN\r\n'
reply: b'250 AUTH=PLAIN LOGIN\r\n'
reply: retcode (250); Msg: b'smtp.sendgrid.net\n8BITMIME\nPIPELINING\nSIZE 31457280\nSTARTTLS\nAUTH PLAIN LOGIN\nAUTH=PLAIN LOGIN'
send: 'STARTTLS\r\n'
reply: b'220 Begin TLS negotiation now\r\n'
reply: retcode (220); Msg: b'Begin TLS negotiation now'
send: 'ehlo [100.64.126.4]\r\n'
reply: b'250-smtp.sendgrid.net\r\n'
reply: b'250-8BITMIME\r\n'
reply: b'250-PIPELINING\r\n'
reply: b'250-SIZE 31457280\r\n'
reply: b'250-STARTTLS\r\n'
reply: b'250-AUTH PLAIN LOGIN\r\n'
reply: b'250 AUTH=PLAIN LOGIN\r\n'
reply: retcode (250); Msg: b'smtp.sendgrid.net\n8BITMIME\nPIPELINING\nSIZE 31457280\nSTARTTLS\nAUTH PLAIN LOGIN\nAUTH=PLAIN LOGIN'
send: 'mail FROM:<2083297662@qq.com> size=360\r\n'
reply: b'550 Unauthenticated senders not allowed\r\n'
reply: retcode (550); Msg: b'Unauthenticated senders not allowed'
send: 'rset\r\n'
reply: b'250 I remember nothing\r\n'
reply: retcode (250); Msg: b'I remember nothing'
send: 'quit\r\n'
reply: b'221 See you later\r\n'
reply: retcode (221); Msg: b'See you later'
127.0.0.1 - - [06/Jun/2019 14:22:55] "POST / HTTP/1.1" 500 -
```