Socket
Socket
Sign inDemoInstall

mailer

Package Overview
Dependencies
0
Maintainers
1
Alerts
File Explorer

Install Socket

Detect and block malicious and high-risk dependencies

Install

    mailer

A module to send email simply in Python


Maintainers
1

Readme

Here are some of the features:

  • Single class to send plain text, HTML email, and attachments
  • Auto detects attachment types
  • Support for internationalized headers

Changes in version 0.3

The API for Mailer.To is changed. Use a string to specify a single recipient, and an iterable to specify more than one.

Changes in version 0.4

You can now specify the port in Mailer ::

from mailer import Mailer sender = Mailer('smtp.example.com', port=20)

Changes in version 0.5

  • Message.attach takes an optional cid argument.
  • You can now send HTML emails with attachments

Thanks to Douglas Mayle for his patch for this.

Changes in version 0.6

  • Can now select port
  • Supports gmail

Changes in version 0.7

  • You can now specify MIME type::

    msg.attach("picture.png", mimetype="image/png")

Changes in version 0.8

  • Various bug fixes

Examples

Sending an HTML email: ::

from mailer import Mailer from mailer import Message

message = Message(From="me@example.com", To="you@example.com", charset="utf-8") message.Subject = "An HTML Email" message.Html = """This email uses HTML!""" message.Body = """This is alternate text."""

sender = Mailer('smtp.example.com') sender.send(message)

Sending an attachment: ::

from mailer import Mailer from mailer import Message

message = Message(From="me@example.com", To=["you@example.com", "him@example.com"], Subject="Cute Cat") message.Body = """Kittens with dynamite""" message.attach("kitty.jpg")

sender = Mailer('smtp.example.com') sender.send(message)

Tested with Python 2.4, 2.5, and 2.6

Keywords

FAQs


Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc