How to send user’s password through email with python?

I have a code that works for recovering a user’s password in case they have forgotten it. This is what I currently have:

from tkinter import *
from PIL import Image, ImageTk
import tkinter as tk
from tkinter import messagebox
import pymysql

windows = Tk()
windows.geometry('500x400+500+100')
windows.attributes('-transparentcolor', 'red')
windows.title('Simple Coding Style')

def back():
    windows.destroy()
    import loginpg

# def submit():
#      if usernameEntry.get() == '' or emailEntry.get() == '' or NewpasswordEntry.get() == '' or confirmpasswordEntry.get() == '':
#          messagebox.showerror('Error', "Entry fields must be entered")
#          return

#      elif NewpasswordEntry.get() != confirmpasswordEntry.get():
#          messagebox.showerror('Error', "Passwords don't match")
#          return
#      else:
#          db = pymysql.connect(host='127.0.0.1', user='root', password='password', database='test')
#          mycursor = db.cursor()
#          query = 'select * from personaldata where email=%s'
#          mycursor.execute(query, (emailEntry.get()))
#          role=mycursor.fetchone() #fetch the existing data
#          if role==None:
#              messagebox.showerror('Error', 'Incorrect email or password')
#          else:
#              query='update personaldata set passwrd=%s where email=%s' 
#              mycursor.execute(query, (NewpasswordEntry.get(),emailEntry.get()))
#              db.commit() 
#              db.close()
#              messagebox.showinfo('Success', 'Please login with New password')

#              windows.destroy()
def fetch_old_password(email):
    db = pymysql.connect(host='127.0.0.1', user='root', password='password', database='test')
    mycursor = db.cursor()
    query = 'SELECT passwrd FROM personaldata WHERE email=%s'
    mycursor.execute(query, (email,))
    result = mycursor.fetchone()
    db.close()
    return result[0] if result else None

def submit():
    email = emailEntry.get()
    old_password = fetch_old_password(email)
    if not old_password:
        messagebox.showerror('Error', 'Email not found')
    else:
        messagebox.showinfo('Old Password', f'Your old password is: {old_password}')
        windows.destroy()


frame=Frame(windows, width=540, height=640, bg='light blue', bd=8)
frame.place(x=0,y=0)

#labels on window
heading =Label(frame, text='FORGOT PASSWORD', fg='black', bg='light blue', font=('Calibre', 15, 'bold'))
heading.place(x=110, y=3)

usernameImage=PhotoImage(file='padlock.png')
usernameLabel=Label(frame, image=usernameImage)
usernameLabel.place(x=45, y=3)

emaillbl = Label(frame, text='Email:', fg='black', bg='light blue', font=('Calibre', 15, 'bold'))
emaillbl.place(x=10, y=140)

emailEntry=Entry(frame, width=30, borderwidth=2)
emailEntry.place(x=250, y=140)


# confirmpasswordEntry=Entry(frame, width=30, borderwidth=2)
# confirmpasswordEntry.place(x=250, y=220)

bckbtn = Button(frame, text='<<', width=7, borderwidth=5, height=2, bg='white', fg='black', cursor='hand2', border=2,
                command=back)
bckbtn.place(x=10, y=300)

submit1btn = Button(frame, text='Submit', width=15, height=2, bg='#7f7fff',fg='white', cursor='hand2', border=2, borderwidth=5, font=('#57a1f8', 16, 'bold'), command=submit)
submit1btn.place(x=130, y=280)

windows.resizable(False,False)
windows.mainloop()

My code is designed for a desktop app. At the moment, it only sends a message to the user directly but I want it so that the recovered password is sent to their email. What should I use or create to apply this feature?

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật