A Python library for send mail easily
Project description
Posts is a Python library for send mail easily.
Installation
pip install posts
Examples
Here is the first one to send a mail in text:
from posts import Posts
mail = Posts('smtp-server', 'your-username', 'your-passwd')
with mail() as box:
box.text('to_address', subject='Subject', content='Content')
Posts does not only support mail in text type, but also support html:
box.html('to_address', subject='Subject', content='Content')
Next, we can send a mail with attachments:
with mail() as box:
box.attach({'example.jpg': './example.jpg})
box.text('to_address')
Finally, we can send the mail in html type with image:
with mail(alias='alias') as box:
box.attach({
'example.jpg': './example.jpg'})
box.html(
recipient='to_address',
subject='subject',
content='<img src="cid:example.jpg">')
Maybe you need to send mail by ssl, don’t worry:
with mail(ssl=True) as box:
box.text('to_address')
Chain Useage
Just try like this:
box.attach(**kwargs).\
attach(**kwargs).\
text(**kwargs)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
posts-0.1.5.tar.gz
(2.6 kB
view hashes)
Built Distribution
posts-0.1.5-py2-none-any.whl
(4.1 kB
view hashes)