Skip to main content

A simple and convinient way to send emails in python

Project description

About

A simple and convenient way to send emails ✉️ in python 🐍

Installation

pip install py3mailer

Usage guide

  1. Importing the module

    from pymailer import EmailService, build_message
    
  2. Build an email message

    • Simple EmailMessage

      message = build_message(fr_addr='john@company.com', # Sender
                              to_addrs=['peter@abc.com'], # List of recipients
                              cc_addrs=['emma@abc.com' ], # List of secondary recipents
                              subject='Subject of Email',
                              content="Plain text contents of the email")
      
    • Extended EmailMessage with html body and attachments

      message = build_message(fr_addr='john@company.com', # Sender
                              to_addrs=['peter@abc.com'], # List of recipients
                              cc_addrs=['emma@abc.com' ], # List of secondary recipents
                              subject='Subject of Email',
                              content="Plain text contents of the email",
                              htmlcontent="<h1>Fancy</h1> html content of the email",
                              attachments=['absolute path to the attachment'])
      
  3. Instantiate EmailSevice and send the message

    service = EmailService(host='smtp.gmail.com',
                           port=587,
                           user='john@company.com',
                           password='This is super secret')
    
    service.sendmail(message)
    

Additional notes:

  • While creating EmailService its optional to specify the password. If the password is not specified it is assumed that the smtp email server does not require authentication.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

py3mailer-1.0.6.tar.gz (5.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

py3mailer-1.0.6-py3-none-any.whl (9.2 kB view details)

Uploaded Python 3

File details

Details for the file py3mailer-1.0.6.tar.gz.

File metadata

  • Download URL: py3mailer-1.0.6.tar.gz
  • Upload date:
  • Size: 5.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.9.5

File hashes

Hashes for py3mailer-1.0.6.tar.gz
Algorithm Hash digest
SHA256 eb9a903ff5101e4aff845c10982e42bfb55159e2467f7fbb71980c27434449f7
MD5 1c1773f6f60d89917dd8f8d0dacd5e80
BLAKE2b-256 7e872b409e3d57e254667ef3ef6e74bf4d438500adfb5122f43b1f92efb515cb

See more details on using hashes here.

File details

Details for the file py3mailer-1.0.6-py3-none-any.whl.

File metadata

  • Download URL: py3mailer-1.0.6-py3-none-any.whl
  • Upload date:
  • Size: 9.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.9.5

File hashes

Hashes for py3mailer-1.0.6-py3-none-any.whl
Algorithm Hash digest
SHA256 bf495b98f2b196875866ed6dad1a19e82343d94115af70e3757651b4a8d1a397
MD5 2841dbc27369a499558a12f5112afcfe
BLAKE2b-256 e42ceb9e09ae1223ed8309405f8ecffe31583873b4562392d3e128e97e3bc2eb

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page