I'm able to send mail using python script , here is my code
import smtplib, ssl
smtp_server = "xxx.yyyy.com"
sender_email = "abcd@efgh.com"
receiver_email = "mnop@efgh.com"
username ='DRAETWK'
password = 'password'
message = """\
Subject: Test Mail
This message is sent from Python."""
context = ssl.create_default_context()
with smtplib.SMTP(smtp_server) as server:
server.login(username, password)
server.sendmail(sender_email, receiver_email, message)
print('Mail Sent... Check your inbox')
Mail send code is working but when I use the same user details I'm not able to read my mail I'm getting login FAILED issue , here is the code
import imaplib
import email.header
from smtplib import SMTP as SMTP
host = 'xxx.yyyy.com'
user = 'abcd@efgh.com'
login_user= 'qweqwr'
password = 'xsw2zsadsadaaq1'
# Connect to the server
print('Connecting to ' + host)
mailBox = imaplib.IMAP4_SSL(host)
mailBox.debug = 100
print(mailBox)
# Login to our account
mailBox.login(login_user, password)
can someone help ?