Metadata-Version: 2.1
Name: gmail-connector
Version: 0.3.9
Summary: Python module to, send SMS, emails and read unread emails.
Home-page: https://github.com/thevickypedia/gmail-connector
Author: Vignesh Sivanandha Rao
Author-email: svignesh1793@gmail.com
License: UNKNOWN
Project-URL: Docs, https://thevickypedia.github.io/gmail-connector
Project-URL: Bug Tracker, https://github.com/thevickypedia/gmail-connector/issues
Keywords: gmail,smtp,imap,tls
Platform: UNKNOWN
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Telecommunications Industry
Classifier: Operating System :: MacOS :: MacOS X
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3.9
Classifier: Topic :: Communications :: Email :: Post-Office :: IMAP
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE

[![Pypi-version](https://img.shields.io/pypi/v/gmail-connector)](https://pypi.org/project/gmail-connector)
[![Pypi-py-version](https://img.shields.io/pypi/pyversions/gmail-connector)](https://pypi.org/project/gmail-connector)

![docs](https://github.com/thevickypedia/gmail-connector/actions/workflows/docs.yml/badge.svg)
![pypi](https://github.com/thevickypedia/gmail-connector/actions/workflows/python-publish.yml/badge.svg)

[![Pypi-format](https://img.shields.io/pypi/format/gmail-connector)](https://pypi.org/project/gmail-connector/#files)
[![Pypi-status](https://img.shields.io/pypi/status/gmail-connector)](https://pypi.org/project/gmail-connector)

![Maintained](https://img.shields.io/maintenance/yes/2021)
[![GitHub Repo created](https://img.shields.io/date/1599432310)](https://api.github.com/repos/thevickypedia/gmail-connector)
[![GitHub commit activity](https://img.shields.io/github/commit-activity/y/thevickypedia/gmail-connector)](https://api.github.com/repos/thevickypedia/gmail-connector)
[![GitHub last commit](https://img.shields.io/github/last-commit/thevickypedia/gmail-connector)](https://api.github.com/repos/thevickypedia/gmail-connector)

# Gmail Connector
Python module to, send SMS, emails and read `unread` emails in `inbox` folder.

###### Modules and Protocols
- `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.

## Usage
`pip install gmail-connector`

<br>

[Send SMS](https://github.com/thevickypedia/gmail-connector/blob/master/gmailconnector/send_sms.py)
```python
from gmailconnector.send_sms import Messenger

response = Messenger(
    gmail_user='username@gmail.com',
    gmail_pass='<ACCOUNT_PASSWORD>',
    phone='+11234567890',
    message='Test SMS using gmail-connector'
).send_sms()
if response.ok:
    print(response.json())
```
<details>
<summary><strong>More on <a href="https://github.com/thevickypedia/gmail-connector/blob/master/gmailconnector/send_sms.py">Send SMS</a></strong></summary>

###### Additional args:
- **subject:** Subject of the message. Defaults to `Message from GmailConnector`
- **carrier:** Use any of ``at&t``, ``t-mobile``, ``verizon``, ``boost``, ``cricket``, ``us-cellular``. Defaults to `t-mobile`.
- **sms_gateway:** SMS gateway of the carrier. Defaults to ``tmomail.net`` since the default carrier is ``t-mobile``.
- **delete_sent:** Boolean flag to delete the outbound email from SentItems. Defaults to ``True``

> Note: If known, using the `sms_gateway` will ensure proper delivery of the SMS.
</details>

[Send Email](https://github.com/thevickypedia/gmail-connector/blob/master/gmailconnector/send_email.py)
```python
from gmailconnector.send_email import SendEmail

response = SendEmail(
        gmail_user='username@gmail.com',
        gmail_pass='<ACCOUNT_PASSWORD>',
        recipient='another_username@gmail.com',
        subject='Howdy!'
    ).send_email()
if response.ok:
    print(response.json())
```
<details>
<summary><strong>More on <a href="https://github.com/thevickypedia/gmail-connector/blob/master/gmailconnector/send_email.py">Send Email</a></strong></summary>

###### 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']`
</details>

[Read Email](https://github.com/thevickypedia/gmail-connector/blob/master/gmailconnector/read_email.py)
```python
from gmailconnector.read_email import ReadEmail

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

### Linting
`PreCommit` will ensure linting, and the doc creation are run on every commit.

**Requirement**
<br>
`pip install --no-cache --upgrade sphinx pre-commit recommonmark`

**Usage**
<br>
`pre-commit run --all-files`

### Change Log
**Requirement**
`pip install --no-cache --upgrade changelog-generator`

**Usage**
`changelog`

### Pypi Module
[https://pypi.org/project/gmail-connector/](https://pypi.org/project/gmail-connector/)

### Runbook
[https://thevickypedia.github.io/gmail-connector/](https://thevickypedia.github.io/gmail-connector/)

### Repository
[https://github.com/thevickypedia/gmail-connector](https://github.com/thevickypedia/gmail-connector)

## License & copyright

&copy; Vignesh Sivanandha Rao, Gmail Connector

Licensed under the [MIT License](https://github.com/thevickypedia/gmail-connector/blob/master/LICENSE)


Change Log
==========

0.3.9 (12/20/2021)
------------------
- Create a separate method to validate input arguments
- Change arg phone_number to phone

0.3.8 (12/20/2021)
------------------
- Fix import issues with module vs sphinx

0.3.7 (12/20/2021)
------------------
- Specify carrier based sms-gateway to increase success rate
- Introduce carrier, sms_gateway and delete_sent as optional arguments
- Use a third-party email-validator to check endpoint before sending the email
- Remove redundant variables
- Add requirements.txt, update README.md and .gitignore

0.3.6 (11/10/2021)
------------------
- Return responses as a class object instead of a dictionary
- Delete messages after sending an SMS
- Do not remove docs directory if version is not bumped
- Generate CHANGELOG in reverse

0.3.5 (10/16/2021)
------------------
- Add project URLs and package requirements to pypi
- Add markdown support to sphinx autodocs
- Add a condition check for version upgrade
- Update docs and changelog

0.3.4 (08/11/2021)
------------------
- Add new lines to the message start to separate subject and body of the SMS
- Update sphinx documentation to 4.1.2

0.3.3 (08/04/2021)
------------------
- Fix incorrect HTTP return codes

0.3.2 (07/24/2021)
------------------
- Remove logger module.
- Add exception handlers for Messenger class.
- Update docs and CHANGELOG
- Bump version.

0.3.1 (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.3.0 (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.9 (07/19/2021)
------------------
- Add logging
- Remove print statements
- Bump version

0.2.8 (07/19/2021)
------------------
- Bump version to support github action
- Auto upload to pypi

0.2.7 (07/19/2021)
------------------
- auto upload to pypi when tagged a release version

0.2.6 (07/19/2021)
------------------
- onboard docs.yml but only prints a statement

0.2.5 (07/19/2021)
------------------
- Add badges
- Update README.md and CHANGELOG
- Bump version

0.2.4 (07/18/2021)
------------------
- Onboard `pypi` module
- Add `setup.py`, `setup.cfg`, `__init__.py`, `CHANGELOG`
- Update README.md and docs
- Move files to `gmailconnector` support package

0.2.3 (07/18/2021)
------------------
- Increase page width and update README.md

0.2.2 (07/18/2021)
------------------
- Onboard send_sms.py and update docs

0.2.1 (07/17/2021)
------------------
- Onboard sphinx auto generated documentation

0.2.0 (07/17/2021)
------------------
- Refactor read_email.py and add send_email.py
- Add pre-commit for linting
- Update README.md

0.1.9 (06/28/2020)
------------------
- update README.md

0.1.8 (06/28/2020)
------------------
- add LICENSE

0.1.7 (06/28/2020)
------------------
- look for env variables before failing

0.1.6 (06/27/2020)
------------------
- included exception handler

0.1.5 (06/27/2020)
------------------
- modify date time type standards instead of using index values

0.1.4 (06/11/2020)
------------------
- fix typo

0.1.3 (06/09/2020)
------------------
- improve coding standards

0.1.2 (06/08/2020)
------------------
- improve coding standards

0.1.1 (06/08/2020)
------------------
- added comments

0.1.0 (06/08/2020)
------------------
- get user input before reading multiple emails

0.0.9 (06/08/2020)
------------------
- get user input before showing any content

0.0.8 (06/08/2020)
------------------
- include number of unread emails on top

0.0.7 (06/08/2020)
------------------
- user input condition to read email

0.0.6 (06/08/2020)
------------------
- pdt to cdt

0.0.5 (06/08/2020)
------------------
- added time when the email was received

0.0.4 (06/08/2020)
------------------
- decode body of the email and display only text part

0.0.3 (06/08/2020)
------------------
- decode raw email using email library

0.0.2 (06/08/2020)
------------------
- read raw email

0.0.1 (06/07/2020)
------------------
- Initial commit


