Skip to main content

A python email library to send and read emails.

Project description

Emaileasily is a python package that simplifies the process of sending and reading emails.

Installation

pip install emaileasily

Modify your email settings:

  • Go to Manage google account -> Security -> Apps passwords ->select app
  • Choose other (Custom name) and enter a name of your choice then click generate.
  • Use the generated password to send and read emails using emaileasily.

If you don't have two-step verification just enable allow less secure apps and use your usual password.

Send Email

>>> from emaileasily import email_to, email_subject, email_content, email_send

# Accepts more than one email address eg email_to('example.gmail.com', 'example5@gmail.com').
>>> email_to('example.gmail.com')
'example.gmail.com'
>>> email_subject('Python Email')
'Python Email'
>>> email_content('This is an example of sending emails with emaileasily')
# email_send() takes sender address and password as key arguments.
# The functions also takes email host and port as optional arguments.
# Default host="smtp.gmail.com" and port=465
>>> email_send('sender@gmail.com', 'password')
Email successfully sent.

Send an email with bcc and cc

>>> from emaileasily import email_to, email_subject, email_content, email_send, email_bcc, email_cc

# Accepts more than one email address.
>>> email_to('example.gmail.com')
'example.gmail.com'
>>> email_bcc('example2@gmail.com')
>>> email_cc('example3@gmail.com')
>>> email_subject('Python Email')
'Python Email'
>>> email_content('This is an example of sending emails with emaileasily')
# email_send() takes sender address and password as key arguments.
# The functions also takes email host and port as optional arguments.
# Default host="smtp.gmail.com" and port=465
>>> email_send('sender@gmail.com', 'password')
Email successfully sent.

Send an email with attached document

>>> from emaileasily import email_to, email_subject, email_content, email_send,email_attach_document
>>> email_to('example.gmail.com')
'example.gmail.com'
>>> email_subject('Python Email')
'Python Email'
>>> email_content('This is an example of sending emails with emaileasily')
# Always call the function after email_content
# The functions gives you the option to select documents for attachment.
>>> email_attach_document()
# email_send() takes sender address and password as key arguments.
# The functions also takes email host and port as optional arguments.
# Default host="smtp.gmail.com" and port=465
>>> email_send('sender@gmail.com', 'password')
Email successfully sent.

Send html email

>>> from emaileasily import email_html
>>> email_html(
    """
    <!DOCTYPE html>
    <html lang="en">
    <head>
        <meta charset="UTF-8">
    </head>
    <body>
    <h3>Message</h3>
    <p> Hello this is a html send message.</p>
    <a href='#'>Click here</a>
    </body>
    </html>
    """
    )

Read Emails

>>> from emaileasily import read_emails
"""
Required arguments:
    - email_address and password.
Optional arguments in order:
    -number of emails to read
        Default: 2
    -label
        Default: "INBOX"
    -host
        Default: 'imap.gmail.com'
    -port
        Default: 993
Change the default values according to preference and email account.
If the email has attachment it will be successfully saved in directory.
"""

# Read top inbox email
>>> read_emails(email_address, email_password, 1)

====================================================================================================
Subject:  Read Emails
From:  sender@gmail.com

Hello,

You can simply read emails using emaileasily read_emails function and pass the arguments
email address, password, the number of emails to read, label, host, port.

Kind regards,
Erastus Nzula.

Read sent emails by replacing the default label with label='"[Gmail]/Sent Mail"'

>>> read_emails(email_address,email_password, number_of_emails, label='"[Gmail]/Sent Mail"')

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

emaileasily-0.2.0.tar.gz (6.2 kB view details)

Uploaded Source

Built Distribution

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

emaileasily-0.2.0-py3-none-any.whl (6.4 kB view details)

Uploaded Python 3

File details

Details for the file emaileasily-0.2.0.tar.gz.

File metadata

  • Download URL: emaileasily-0.2.0.tar.gz
  • Upload date:
  • Size: 6.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.7 tqdm/4.62.3 importlib-metadata/4.11.2 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.10.3

File hashes

Hashes for emaileasily-0.2.0.tar.gz
Algorithm Hash digest
SHA256 d507a9c3c8b4648f1c028f48a0f2ba7b4bf9f2ff967b939512f548117ef98dcb
MD5 24e0cd28268c17ae258c3fa4cb4ba961
BLAKE2b-256 486b72a33eca97811ed13a1b969a456a96a890528b2e0a920b307687776f0cfb

See more details on using hashes here.

File details

Details for the file emaileasily-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: emaileasily-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 6.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.7 tqdm/4.62.3 importlib-metadata/4.11.2 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.10.3

File hashes

Hashes for emaileasily-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5a24c4c01a9f13ef66b930f6ddc5cc103a2ec018db2d12217a6633e2fa2fb56d
MD5 cdd9ab081e922aaf70767a8b67bcbd2d
BLAKE2b-256 c079c5597825abe4e39dad4dfdd94f247a6449259c581fddadcd2d481874182d

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