email helper for simple send email and receive email of python
Project description
# email_helper
> only support python3
> 默认服务器为163免费邮箱服务器,也可以自己配置
# 安装
```
$ pip install email-helper
```
# 发送邮件
```python
from email_helper.email_sender import EmailSender
# 实例化
email = EmailSender(from_addr="xxx@163.com", password="xxx")
# 设置标题
email.set_header("这是邮件标题")
# 添加正文
email.add_text("这是邮件的文本")
# 添加收件人
email.add_receiver("ooo@163.com")
# 发送
email.send()
```
# 接收邮件
```python
from email_helper.email_receiver import EmailReceiver
# 实例化
client = EmailReceiver(email="xxx@163.com", password="xxx")
# 接收最后一封邮件
email = client.get_last_email()
# 打印邮件信息
for k, v in email.items():
print(k , v)
"""
From <xxx@163.com>
To <ooo@163.com>
Subject 这是邮件标题
text ['这是邮件的文本']
attachment []
"""
```
> only support python3
> 默认服务器为163免费邮箱服务器,也可以自己配置
# 安装
```
$ pip install email-helper
```
# 发送邮件
```python
from email_helper.email_sender import EmailSender
# 实例化
email = EmailSender(from_addr="xxx@163.com", password="xxx")
# 设置标题
email.set_header("这是邮件标题")
# 添加正文
email.add_text("这是邮件的文本")
# 添加收件人
email.add_receiver("ooo@163.com")
# 发送
email.send()
```
# 接收邮件
```python
from email_helper.email_receiver import EmailReceiver
# 实例化
client = EmailReceiver(email="xxx@163.com", password="xxx")
# 接收最后一封邮件
email = client.get_last_email()
# 打印邮件信息
for k, v in email.items():
print(k , v)
"""
From <xxx@163.com>
To <ooo@163.com>
Subject 这是邮件标题
text ['这是邮件的文本']
attachment []
"""
```
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
email_helper-0.0.3.tar.gz
(4.5 kB
view details)
Built Distribution
File details
Details for the file email_helper-0.0.3.tar.gz
.
File metadata
- Download URL: email_helper-0.0.3.tar.gz
- Upload date:
- Size: 4.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2ba0225f0b55df86f5fcbef05ff242d58e3ab72c09eafc2039776a34f4d84c58 |
|
MD5 | 8fccfe0b94bb96134e6b40c356cc025e |
|
BLAKE2b-256 | 0e756286d87560208bcf72f9fe59f162863930f6430c65ae466711ac249a3ee2 |
File details
Details for the file email_helper-0.0.3-py3-none-any.whl
.
File metadata
- Download URL: email_helper-0.0.3-py3-none-any.whl
- Upload date:
- Size: 7.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 085ea65582f9fd9c4a702c00c05c02d110f386bddc5858312d3aeb24e1efb982 |
|
MD5 | 628e062d2b889af53f5c3b911abfa065 |
|
BLAKE2b-256 | 4b2f39562c08a7b8a8bdda4af9a996f937067f8e0c808487cb44a6db0e3c1029 |