📧 Email Module Guide
This page is currently only available in Chinese. Please switch to 简体中文 for the full content.
📧 Email Module Guide
The Email module enables automatic sending and receiving of emails, with support for attachments, CC, mass sending and other advanced features.
Core Scenarios
Send a Simple Email
import office
office.email.send_email(
key='your_email_authorization_code',
msg_from='your@qq.com',
msg_to='target@qq.com',
msg_subject='Meeting Notice',
content='Meeting at 3 PM tomorrow.'
)
Send Email with Attachment
office.email.send_email(
key='your_email_authorization_code',
msg_from='your@qq.com',
msg_to='target@qq.com',
msg_subject='Weekly Report',
content='Please find attached this week\'s report.',
attach_files=['./report.pdf', './data.xlsx']
)
CC Multiple People
office.email.send_email(
key='your_email_authorization_code',
msg_from='your@qq.com',
msg_to='primary@qq.com',
msg_cc='cc1@qq.com, cc2@qq.com',
msg_subject='Project Meeting',
content='Meeting at 3 PM tomorrow.'
)
Receive Emails
office.email.receive_email(
key='your_email_authorization_code',
msg_from='your@qq.com',
msg_to='sender@qq.com',
output_path='./received_emails/',
status='UNSEEN'
)
Email Configuration
| host | Port | |
|---|---|---|
| smtp.qq.com | 465 | |
| 163 | smtp.163.com | 465 |
| Gmail | smtp.gmail.com | 587 |
⚠️ The
keyhere is the authorization code, not the login password!
Full API see Email API Reference