from imaplib import IMAP4 >>> with IMAP4("[1]domain.org") as M: ... M.noop() ... :) this stuff is really hard so, being on the edge of psychotic break, retain focus on feelings that need a little grounding in some way. not letting focuses get so strong that here is gmail docs: [2]https://support.google.com/mail/answer/7126229 - imap needs to be enabled in gmail settings. then: Incoming Mail (IMAP) Server [3]imap.gmail.com Requires SSL: Yes Port: 993 Outgoing Mail (SMTP) Server [4]smtp.gmail.com Requires SSL: Yes Requires TLS: Yes (if available) Requires Authentication: Yes Port for SSL: 465 Port for TLS/STARTTLS: 587 Full Name or Display Name Your name Account Name, User name, or Email address Your full email address Password Your Gmail password References 1. http://domain.org/ 2. https://support.google.com/mail/answer/7126229 3. http://imap.gmail.com/ 4. http://smtp.gmail.com/