It makes sending emails easier with Python.
Project description
It makes sending mail easier. The main features:
- It allows you specify SMTP headers by keyword arguments.
- Support interactive prompt for username or password.
- Support optional with statement.
Installation
You can install it via PyPI,
sudo pip install postbox
or download it manually.
Examples
It is an example which sends a mail from Python Shell.
>>> from postbox import Postbox, Gmail >>> gmail = Postbox(host='smtp.google.com:587') # or gmail = Gmail() username? mosky.bot@gmail.com password? >>> gmail.send( ... to = ['mosky.tw@gmail.com', 'mosky.liu@pinkoi.com'], ... bcc = 'mosky@ubuntu-tw.org', ... subject = 'Test from Python Shell', ... body = 'It is used postbox to send. :)' ... ) ... >>> gmail.close() >>>
You can find more examples here.
Documentation
The Postbox or Gmail accepts the following keyword arguments:
- host: the hostname of your SMTP server. ex. ‘smtp.google.com’ or ‘smtp.google.com:587’
- port: the port number of your SMTP server.
- user: the username.
- password: the password.
- tls: use tls or not.
- prompt_user: prompt string if you don’t specified user.
- prompt_password: prompt string if you don’t specified password.
- debuglevel: the debuglevel.
- dry_run: don’t send the mail out.
The all keyword arguments to send will be translated into SMTP headers, except the body is the body of this mail. If you don’t specify from_, it takes the username as default. The iterable but not string will be joined to a string by comma.
Project details
Release history Release notifications
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Filename, size | File type | Python version | Upload date | Hashes |
---|---|---|---|---|
Filename, size postbox-0.1.tar.gz (2.7 kB) | File type Source | Python version None | Upload date | Hashes View hashes |