Skip to main content

Email Service Package

Project description

Simple Mail Sender

This email sender python package gives ease of acess to Python's built-in SMTP module. It supports plaintext and HTML based messages and only supports Python3 version.

Features

  • Reduces the configurations needed for built-in modules.
  • Can send emails fetching from plain text or through HTML templates.
  • TLS or SSL can be used to connect to the SMTP servers.

Installation

pip install emailservice

Usage

Sending a simple plaintext message

    plaintext = 'This is our text message'
  • Create a EmailService object. The EmailService object allows you to connect to an SMTP server by specifying the server address and port, as well as your username and password.
    testEmailService = EmailService('username@server.com', 'password', ('smtp.server.com', 465), use_SSL=True)
  • Now we set the plaintext message to the email's body.
    testEmailService.set_message(plaintext, "Subject", 'John Doe <j.doe@server.com>')
  • Set the recipients for your email by specifying a complete list/tuple of all the mentioned recipients.
    testEmailService.set_recipients(['recepient1@server.com', 'recepient2@server.com'])
  • Here we connect to the SMTP server you specified when creating the EmailService object.
    testEmailService.connect()
  • Below method sends the same message to all listed recipients. By default the connection to the SMTP server is closed once the email has been sent to all currently listed recipients. If you want to send further emails without having to reconnect to the SMTP server, you can make the close_connection as False as shown below.
    testEmailService.send_all(close_connection=False)

Sending an HTML message

  • Import or write both a plaintext message and HTML message, stored in separate variables. This plaintext is only shown in cases where email clients do not support HTML markup.
    plaintext = 'This is our message'
    html = '<b>This</b> is our message'
  • Set the HTML and plaintext messages as the email's body.
    testEmailService.set_message(plaintext, "Subject line", 'John Doe', html)

Recommended SMTP server settings

Outlook:

  • Using TLS: smtp.live.com, port 587

Gmail:

  • Using SSL: smtp.gmail.com, port 465
  • Using TLS: smtp.gmail.com, port 587
  • These connections may be blocked if 'Access for less secure apps' is disabled in your Google Account settings

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

emailservice-0.0.5.tar.gz (4.7 kB view details)

Uploaded Source

Built Distribution

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

emailservice-0.0.5-py3-none-any.whl (7.1 kB view details)

Uploaded Python 3

File details

Details for the file emailservice-0.0.5.tar.gz.

File metadata

  • Download URL: emailservice-0.0.5.tar.gz
  • Upload date:
  • Size: 4.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.0

File hashes

Hashes for emailservice-0.0.5.tar.gz
Algorithm Hash digest
SHA256 7176ec1f965773582d222721eac45ee2211d7c3fd161155680b664260e513431
MD5 a72ee2663150ad15bb268fb332a90548
BLAKE2b-256 be01660813b41a223d61fa7b07aef243df83ef088d2bab95fe67c58620409078

See more details on using hashes here.

File details

Details for the file emailservice-0.0.5-py3-none-any.whl.

File metadata

  • Download URL: emailservice-0.0.5-py3-none-any.whl
  • Upload date:
  • Size: 7.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.0

File hashes

Hashes for emailservice-0.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 b3b99008d0f23248c0c4068dae2e81649840bcd3f39485677bdad5deab305d19
MD5 93f15ac9a826ed6c7a39fd4a6cbf40be
BLAKE2b-256 4d3836553b7ef20feacc0e69e9117214a7841b728c084f55902346571a89b33c

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