pythonflaskflask-mail

app console showing alot on redlines without any error when sending email with flask


i have simpel flask app and i want to send email for conformation to user i test it with my email everything works fien but i get alot of redline in my app console i am totaly begginer and i cant analyze what happen here plaese tell me what is this and what can i do

this is my function for sending email :

@app.route("/confirm", methods=["POST", "GET"])
@login_required
def confirm():
    user_email = current_user.email
    token = serializer.dumps(user_email, salt="email-confirm")
    link = url_for("confirm_email", token=token, _external=True)
    msg = Message("Confirm Email", sender=app.config["MAIL_USERNAME"], recipients= [user_email])
    msg.body = render_template("public/email.html", user=current_user, link=link)
    msg.html = render_template("public/email.html", user=current_user, link=link)
    mail.send(msg)
    return render_template("public/index.html", time=time, user=current_user, link=link)

and i get this red lines :

send: 'ehlo [172.31.128.1]\r\n'
reply: b'250-smtp.gmail.com at your service, [80.210.8.202]\r\n'
reply: b'250-SIZE 35882577\r\n'
reply: b'250-8BITMIME\r\n'
reply: b'250-AUTH LOGIN PLAIN XOAUTH2 PLAIN-CLIENTTOKEN OAUTHBEARER XOAUTH\r\n'
reply: b'250-ENHANCEDSTATUSCODES\r\n'
reply: b'250-PIPELINING\r\n'
reply: b'250-CHUNKING\r\n'
reply: b'250 SMTPUTF8\r\n'
reply: retcode (250); Msg: b'smtp.gmail.com at your service, [80.210.8.202]\nSIZE 35882577\n8BITMIME\nAUTH LOGIN PLAIN XOAUTH2 PLAIN-CLIENTTOKEN OAUTHBEARER XOAUTH\nENHANCEDSTATUSCODES\nPIPELINING\nCHUNKING\nSMTPUTF8'
send: 'AUTH PLAIN AGZyZXNoLnBvdXJ5YUBnbWFpbC5jb20AeXFubmt6cXF2eWpud3VkZQ==\r\n'
reply: b'235 2.7.0 Accepted\r\n'
reply: retcode (235); Msg: b'2.7.0 Accepted'
send: 'mail FROM:<fresh.pourya@gmail.com> size=3274\r\n'
reply: b'250 2.1.0 OK q16-20020adfea10000000b002c559def236sm12683509wrm.57 - gsmtp\r\n'
reply: retcode (250); Msg: b'2.1.0 OK q16-20020adfea10000000b002c559def236sm12683509wrm.57 - gsmtp'
send: 'rcpt TO:<mr.guitar.clash@gmail.com>\r\n'
reply: b'250 2.1.5 OK q16-20020adfea10000000b002c559def236sm12683509wrm.57 - gsmtp\r\n'
reply: retcode (250); Msg: b'2.1.5 OK q16-20020adfea10000000b002c559def236sm12683509wrm.57 - gsmtp'
send: 'data\r\n'
reply: b'354  Go ahead q16-20020adfea10000000b002c559def236sm12683509wrm.57 - gsmtp\r\n'
reply: retcode (354); Msg: b'Go ahead q16-20020adfea10000000b002c559def236sm12683509wrm.57 - gsmtp'
data: (354, b'Go ahead q16-20020adfea10000000b002c559def236sm12683509wrm.57 - gsmtp')
send: b'Content-Type: multipart/mixed; boundary="===============1820571993399238898=="\r\nMIME-Version: 1.0\r\nSubject: Confirm Email\r\nFrom: fresh.pourya@gmail.com\r\nTo: mr.guitar.clash@gmail.com\r\nDate: Tue, 07 Mar 2023 18:29:08 +0330\r\nMessage-ID: <167820114761.3828.4077954944079907248@DESKTOP-TKGFEBA>\r\n\r\n--===============1820571993399238898==\r\nContent-Type: multipart/alternative;\r\n boundary="===============0785586450470497431=="\r\nMIME-Version: 1.0\r\n\r\n--===============0785586450470497431==\r\nContent-Type: text/plain; charset="utf-8"\r\nMIME-Version: 1.0\r\nContent-Transfer-Encoding: 7bit\r\n\r\n<!DOCTYPE html>\r\n<html lang="en">\r\n<head>\r\n    <meta charset="UTF-8">\r\n    <title>Confirm Email</title>\r\n    <link href="https://fonts.googleapis.com/css2?family=Anton&family=Dancing+Script:wght@700&family=Mynerve&family=Roboto:wght@500&display=swap" rel="stylesheet">    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.5.0/font/bootstrap-icons.css">\r\n    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.0.0/dist/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">\r\n\r\n</head>\r\n<body>\r\n    <div class="container-fluid" style="background-color: #666666; padding: 5% 20px 0; margin: 0">\r\n        <h1 style="font-family: \'Dancing Script\', cursive; margin: 0">Favorite Cafe</h1>\r\n\r\n    </div>\r\n    <div class="container-fluid" style="background-color: #6096B4; padding: 5%">\r\n        <h3 style="margin: 0">Dear FATEMEH mohamadi</h3>\r\n        <p>click on the link blow to active confirm your email account this link will expire after 24 hours</p>\r\n        <a href="http://127.0.0.1:5000/confirm-email/Im1yLmd1aXRhci5jbGFzaEBnbWFpbC5jb20i.J0k1dPV51jFl1QMzo6tdg3UeWWU">Confirm</a>\r\n\r\n    </div>\r\n</body>\r\n</html>\r\n--===============0785586450470497431==\r\nContent-Type: text/html; charset="utf-8"\r\nMIME-Version: 1.0\r\nContent-Transfer-Encoding: 7bit\r\n\r\n<!DOCTYPE html>\r\n<html lang="en">\r\n<head>\r\n    <meta charset="UTF-8">\r\n    <title>Confirm Email</title>\r\n    <link href="https://fonts.googleapis.com/css2?family=Anton&family=Dancing+Script:wght@700&family=Mynerve&family=Roboto:wght@500&display=swap" rel="stylesheet">    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.5.0/font/bootstrap-icons.css">\r\n    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.0.0/dist/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">\r\n\r\n</head>\r\n<body>\r\n    <div class="container-fluid" style="background-color: #666666; padding: 5% 20px 0; margin: 0">\r\n        <h1 style="font-family: \'Dancing Script\', cursive; margin: 0">Favorite Cafe</h1>\r\n\r\n    </div>\r\n    <div class="container-fluid" style="background-color: #6096B4; padding: 5%">\r\n        <h3 style="margin: 0">Dear FATEMEH mohamadi</h3>\r\n        <p>click on the link blow to active confirm your email account this link will expire after 24 hours</p>\r\n        <a href="http://127.0.0.1:5000/confirm-email/Im1yLmd1aXRhci5jbGFzaEBnbWFpbC5jb20i.J0k1dPV51jFl1QMzo6tdg3UeWWU">Confirm</a>\r\n\r\n    </div>\r\n</body>\r\n</html>\r\n--===============0785586450470497431==--\r\n\r\n--===============1820571993399238898==--\r\n.\r\n'
reply: b'250 2.0.0 OK  1678201150 q16-20020adfea10000000b002c559def236sm12683509wrm.57 - gsmtp\r\n'
reply: retcode (250); Msg: b'2.0.0 OK  1678201150 q16-20020adfea10000000b002c559def236sm12683509wrm.57 - gsmtp'
data: (250, b'2.0.0 OK  1678201150 q16-20020adfea10000000b002c559def236sm12683509wrm.57 - gsmtp')
send: 'quit\r\n'
reply: b'221 2.0.0 closing connection q16-20020adfea10000000b002c559def236sm12683509wrm.57 - gsmtp\r\n'
reply: retcode (221); Msg: b'2.0.0 closing connection q16-20020adfea10000000b002c559def236sm12683509wrm.57 - gsmtp'
127.0.0.1 - - [07/Mar/2023 18:29:09] "GET /confirm HTTP/1.1" 200 -

Solution

  • t's actually in the documentation MAIL_DEBUG defualt value is True and i just change it to false and i dont see this messages anymore

    Set MAIL_DEBUG = False