Hi@akhtar,
You can connect mail server using smtplib and ssl module. Use the below given code.
import smtplib,ssl,getpass
smtp_server = 'smtp.gmail.com'
port = 465
sender = 'nadim70.na@gmail.com'
password = getpass.getpass('Enter your password')
context = ssl.create_default_context()
with smtplib.SMTP_SSL(smtp_server,port,context=context) as server:
server.login(sender,password)
print('Successfully connect')
Hope this will help you.