Skip to main content

python-emailer

Downloads Downloads per month Downloads per week

What is it?

python-emailer is a Python package that aids in sending of emails. It is a robust package which aims to cover every aspect of sending emails thereby, helping developers code less.

Typical Usage

from python_emailer.email_processing import PyMailer

login_details = ['sender_email', 'password']

email_sender = PyMailer('recipient_data.csv', login_details, 
                        subject='Job Application', 'Find attached my cv')

email_sender.send_email(file_path='cv.pdf')

Main Features

Here are some of the supported features of python-emailer:

  • Checks and cleans common errors in email addresses like ( unexpected spaces, fullstops).
  • Checks for valid email address syntax
  • Reads email content from strings, .html files, or .txt files
  • Reads recipient data from string, list, tuple, set, dictionary, .json, and .csv files.
  • Auto detects the SMTP host of the provided sender email address.
  • Attaches files to the email. Can also attach all files in a given directory. Can also display files(images) in the email.
  • Auto detects the message type of the email(html or plain)
  • Includes recipient's name in the email after the provided introductory string(i.e Hello <recipient_name>)

Where to get it

The source code is hosted on Github: https://github.com/hilariie/python-emailer

And can be installed from Python Package Index(PyPI)

pip install python-emailer

Dependencies

This package only makes use of python builtin packages.

License

MIT

Contributing

Contributions, bug reports and fixes, documentation improvements and enhancements, and ideas are all welcome.

To contribute:

  • Fork this repo

  • Clone your repo

    git clone <your repo>

  • Make commit changes

    git add <changed files>

    git commit -m "commit message

  • Push changes

    git push ..

  • Create a pull request

How to use

File attachments:

To attach files to an email, provide the path to the files to the file_path argument of send_email


For a cv.pdf file.

...
send_email(file_path='C:\\email\\attachments\\cv.pdf')

To attach multiple files, pass the directory instead

...
send_email(file_path='C:\\email\\attachments')

To display images in email, make sure you have cid:<image_name> in your email content/message where you want to display the image. An example is shown below

Hello, 
    <p>Below is the order of the meetup</p>
    <p>
    <img height="auto" src="cid:image_test" style=".." width="100"/>
    </p>

pass in the exact cid value in the send_email method

send_email(cid_img='image_test')

Greeting:

For multiple recipients (names and email addresses) where you wish to address them by names,simply pass the greeting string.

send_email(greeting='Hello')

email appears as:

Hello <recipient_name>

Email body


Recipient data:

Recipient data can be read from various data and file types such as

  • sets - recipient email addresses
  • lists - recipient email addresses
  • tuples - recipient email addresses
  • dictionaries - recipient email addresses, names, and cc
  • string - recipient email addresses
  • .json files - recipient email addresses, names, and cc
  • .csv files - recipient email addresses, names, and cc
.csv files:

csv files should be arranged in this order below screenshot

.json files/dictionaries

Dictionaries should be in one of the two structures

  • {names:[name1, name2, ...], emails:[email1, email2, ...], cc:[cc1, cc2, ...]}
  • {name1:email1, name2:email2, ...}

Metadata

Release files for python-emailer 1.5.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for python-emailer 1.5.4
File Size Uploaded Provenance Actions
python_emailer-1.5.4.tar.gz 12.1 kB Without provenance Details for python_emailer-1.5.4.tar.gz

Release files / python_emailer-1.5.4.tar.gz

Download URL python_emailer-1.5.4.tar.gz
Size 12.1 kB
Tags Source
SHA-256 checksum
How to use checksums
c630a8c9587aa5b579043ea25606f20f7fcc9c02426ff6adcd067f4f55956410
BLAKE2b-256 checksum
How to use checksums
104b601501622e0ce679ab7658a5afa46c33569cee5480f8f0973835305e8466
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.16

Security for python-emailer 1.5.4

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page