Seite 1 von 1

nach neuen Email sehen

Verfasst: Freitag 12. Februar 2016, 11:33
von achim55
Hallo,
ich als Neuling möchte mir eine Abfrage basteln die mir anzeigt ob neue Emails in einem Postfach vorhanden sind.
Es reicht nur die Benachrichtig : Sie haben XX neue Mails.

ich bekomme aber eine Fehlermeldung. Die Logindaten sind aber richtig.

imaplib.error: b'Login failed.'


Gruß
Achim


#!/usr/bin/env python


import imaplib

imap_host = 'mail.xxxx.de'
imap_user = 'xx@xx.de'
imap_pass = 'xxxxxxx'

## open a connection
imap = imaplib.IMAP4(imap_host)

## login
imap.login(imap_user, imap_pass)

## get status for the mailbox (folder) INBOX
folderStatus, UnseenInfo = imap.status('INBOX', "(UNSEEN)")

print (folderStatus)
print (imap)