Django, view the email received by imaplib in my webpage
I am trying to create a mail client using Django.
I am fetching the body of emails from my inbox this way using imaplib:
def get_email_body(username, password, imap, email_id):
USERNAME = username
PASSWORD = password
IMAP = imap
mail = imaplib.IMAP4_SSL(IMAP)
mail.login(USERNAME, PASSWORD)
try:
mail.select("inbox")
result, data = mail.search(None, "ALL")
ids = data[0]
id_list = ids.split()
current_email_id = int(id_list[-1]) - int(email_id)
result, data = mail.fetch(str(current_email_id), "(RFC822)")
raw_email = data[0][1].decode("utf-8")
return raw_email
except Exception as ex:
print(ex)
How can I display my emails from this form: multi-user email to this form: beautiful gmail mail
I would be grateful if you could give me at least instructions on how to study the problem. Thank!
+3
source to share
No one has answered this question yet
Check out similar questions: