pip install inbox.py python import inbox def connect_to_mailbox(): mail = inbox.Inbox() mail.login('username', 'password', 'imap.server.com') print('Connected to mailbox') return mail mail = connect_to_mailbox() python def get_inbox_emails(mail): emails = mail.filter() for email in emails: print('Subject:', email.subject) print('From:', email.sender) get_inbox_emails(mail) python def send_email(mail): new_email = mail.new() new_email.to = 'recipient@example.com' new_email.subject = 'Hello, World!' new_email.body = 'This is the body of the email.' new_email.send() print('Email sent successfully') send_email(mail)


上一篇:
下一篇:
切换中文