Skip to main content

Python module to, send SMS, emails and read unread emails.

Project description

Pypi-version Pypi-py-version

docs pypi

Pypi-format Pypi-status

Maintained GitHub Repo created GitHub commit activity GitHub last commit

Gmail Connector

Python module to, send SMS, emails and read unread emails in inbox folder.

Uses the default python modules:
  • email - Format emails as MIMEMultipart object, read emails from bytes and str and decode headers.
  • smtplib - SMTP Simple Mail Transfer Protocol to connect to gmail server, do auth and perform outgoing tasks.
  • imaplib - IMAP Internet Message Access Protocol to access messages in an email mailbox.
  • datetime - Uses datetime module to skim the date and time when the email arrived.

Pypi Module

https://pypi.org/project/gmail-connector/

Usage

pip install gmail-connector


Send SMS

from gmailconnector.send_sms import Messenger

messenger = Messenger(
    gmail_user='username@gmail.com',
    gmail_pass='<ACCOUNT_PASSWORD>',
    phone_number='+11234567890',
    message='Test SMS using gmail-connector'
)
print(messenger.send_sms())

Send Email

from gmailconnector.send_email import SendEmail

email_obj = SendEmail(
        gmail_user='username@gmail.com',
        gmail_pass='<ACCOUNT_PASSWORD>',
        recipient='another_username@gmail.com',
        subject='Howdy!'
    )
print(email_obj.send_email())
More on SendEmail
Additional args:
  • body: Body of the email. Defaults to blank.
  • attachment: Filename that has to be attached.
  • cc: Email address of the recipient to whom the email has to be CC'd.
  • bcc: Email address of the recipient to whom the email has to be BCC'd.

Note: To send email to more than one recipient, wrap recipient/cc/bcc in a list.

recipient=['username1@gmail.com', 'username2@gmail.com']

Read Email

from gmailconnector.read_email import ReadEmail

ReadEmail(
    gmail_user='username@gmail.com',
    gmail_pass='<ACCOUNT_PASSWORD>'
).read_email()

Pre-Commit

Install pre-commit to run flake8 and isort for linting and sphinx for documentation generator.

pip3 install pre-commit==2.13.0 Sphinx==4.1.1

pre-commit run --all-files

Runbook

https://thevickypedia.github.io/gmail-connector/

License & copyright

© Vignesh Sivanandha Rao, Gmail Connector

Licensed under the MIT License

Change Log

0.0.14 (07/18/2021)

  • Delete broken releases
  • Modify and update CHANGELOG
  • Change URL for HomePage

0.0.15 (07/18/2021)

  • Update project description and README.md

0.0.16 (07/19/2021)

  • Add module usage in description
  • Fix broken hyperlinks in README.md
  • Setup github actions for pypi publish

0.0.17 (07/19/2021)

  • Bump version.
  • Supports github action to auto upload to pypi.

0.0.18 (07/19/2021)

  • Add logger module.
  • Remove print statements.

0.1.9 (07/19/2021)

  • Allow users to add multiple recipients while sending email.
  • Add CC and BCC options.
  • Check if attachment file is available before trying to attach.
  • Wrap recipient, cc and bcc items in a single list before email kick off.
  • Remove sender arg and default to the user login email address.
  • Fix version number format.

0.2.0 (07/22/2021)

  • Return a dictionary element after sending an email/SMS.
  • Add status code and description to return dict.
  • Update docs and CHANGELOG
  • Bump version.

0.2.1 (07/24/2021)

  • Remove logger module.
  • Add exception handlers for Messenger class.
  • Update docs and CHANGELOG
  • Bump version.

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

gmail-connector-0.2.1.tar.gz (9.1 kB view hashes)

Uploaded Source

Built Distribution

gmail_connector-0.2.1-py2.py3-none-any.whl (9.9 kB view hashes)

Uploaded Python 2 Python 3

Supported by

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