A simple tool for sending mail by Python
Project description
A simple tool for sending mail by Python
Install
sudo pip install PyMailMan
Usage
To send the text
from PyMailMan import PyMailMan
mail = PyMailMan(host='smtp.qq.com', user='12345678', password='12345678')
mail.send(
['783087000@qq.com'],
'This is title',
'This is the content'
)
print 'OK' if mail.status else mail.errMsg
To send the HTML
from PyMailMan import PyMailMan
mail = PyMailMan(host='smtp.qq.com', user='12345678', password='12345678')
mail.send(
['783087000@qq.com'],
'This is title',
"<p style='color:red'>This is the content</p>"
)
print 'OK' if mail.status else mail.errMsg
To send the email with file
from PyMailMan import PyMailMan
mail = PyMailMan(host='smtp.qq.com', user='12345678', password='12345678')
#You need to write the absolute path of the file
mail.send(
['783087000@qq.com'],
'This is title',
'This is the content',
'/home/kongkongyzt/a.txt',
'/home/kongkongyzt/b.txt'
)
print 'OK' if mail.status else mail.errMsg
common mail smtp configure
assume the email address is 1234567@xx.com and password is 12345678 + QQ Mail
PyMailMan(host='smtp.qq.com', user='12345678', password='12345678')
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
PyMailMan-0.6.tar.gz
(2.0 kB
view hashes)