Receive replies from Gmail with smtplib - Python

后端 未结 3 847
囚心锁ツ
囚心锁ツ 2020-12-18 00:01

Ok, I am working on a type of system so that I can start operations on my computer with sms messages. I can get it to send the initial message:

import smtpli         


        
3条回答
  •  时光说笑
    2020-12-18 00:33

    I can suggest you to use this new lib https://github.com/charlierguo/gmail

    A Pythonic interface to Google's GMail, with all the tools you'll need. Search, read and send multipart emails, archive, mark as read/unread, delete emails, and manage labels.

    Usage

    from gmail import Gmail
    
    g = Gmail()
    g.login(username, password)
    
    #get all emails
    mails = g.inbox().mail() 
    # or if you just want your unread mails
    mails = g.inbox().mail(unread=True, from="youradress@gmail.com")
    
    g.logout()
    

提交回复
热议问题