Skip to content

johaness/postamt

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

postamt

Light package that makes typical mail tasks easy:

  • Mail body both in plain text and HTML
  • Unicode in body and subject
  • Inline attachments (e.g. for HTML resources)
  • Attachments, with optional mime-type detection

Usage

Create a plain Message and send it:

m = Message("sender@example.org", "to@example.net", "Re: Mail Lib", "Hi!")
send_mails([m])

Messages can be altered:

m.subject = "The Plan"
m.body = "Hi!\\nK-thx-bye!"

# add an alternative HTML version
m.html = "<h1>Hi!</h1>"

m.recipients = ['to@example.net', 'metoo@example.net']
m.cc = 'someone@example.net'
m.bcc = 'mum@example.org'

m.date = 387784800
m.headers['X-Client-ID'] = 655

Send HTML Mails with inline Images:

m.html = "Look at this: <img src='cid:amazing.png'> isnt that cool?"
m.inline('amazing.png', file('newlook.png'))

Attach files:

m.attach('notice.pdf', file('notice.pdf'))

See pydoc for a full description of all parameters.

About

simple mail creation & sending for python 2

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages