cs-guide/docs/python-tutor/python-tips/send-email.md
2022-04-05 23:17:32 +08:00

39 lines
1.4 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 发送邮件
设置outlook的地址
[https://support.microsoft.com/zh-cn/office/outlook-com-%E7%9A%84-pop-imap-%E5%92%8C-smtp-%E8%AE%BE%E7%BD%AE-d088b986-291d-42b8-9564-9c414e2aa040](https://support.microsoft.com/zh-cn/office/outlook-com-%E7%9A%84-pop-imap-%E5%92%8C-smtp-%E8%AE%BE%E7%BD%AE-d088b986-291d-42b8-9564-9c414e2aa040)
```python
conf = ConnectionConfig(MAIL_USERNAME="Microsoft@outlook.com",
MAIL_PASSWORD="123456",
MAIL_FROM="Microsoft@outlook.com",
MAIL_PORT=587,
MAIL_SERVER="smtp-mail.outlook.com",
MAIL_FROM_NAME="Microsoft",
MAIL_TLS=True,
MAIL_SSL=False,
USE_CREDENTIALS=True,
VALIDATE_CERTS=True)
```
如下图
| **电子邮件提供商** | **IMAP 设置** | **POP 设置** | **SMTP 设置** |
| ------------------ | ------------- | ------------ | ------------- |
| Microsoft 365 |
Outlook
Hotmail
Live.com | 服务器outlook.office365.com
端口993
加密SSL/TLS | 服务器outlook.office365.com
端口995
加密SSL/TLS | 服务器smtp.office365.com
端口587
加密STARTTLS |
| MSN | 服务器imap-mail.outlook.com
端口993
加密SSL/TLS | 服务器pop-mail.outlook.com
端口995
加密SSL/TLS | 服务器smtp-mail.outlook.com
端口587
加密STARTTLS |