https://github.com/dros1986/emailclient
Email Client for reading and sending emails.
https://github.com/dros1986/emailclient
email email-client email-reader email-sender gmail gmail-api gmail-python google-mail imap imap-client mail pip smtp smtp-client
Last synced: 12 days ago
JSON representation
Email Client for reading and sending emails.
- Host: GitHub
- URL: https://github.com/dros1986/emailclient
- Owner: dros1986
- Created: 2020-05-27T14:49:38.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2022-06-28T09:07:06.000Z (almost 3 years ago)
- Last Synced: 2025-04-15T00:09:08.801Z (12 days ago)
- Topics: email, email-client, email-reader, email-sender, gmail, gmail-api, gmail-python, google-mail, imap, imap-client, mail, pip, smtp, smtp-client
- Language: Python
- Homepage:
- Size: 17.6 KB
- Stars: 8
- Watchers: 2
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
## Usage
This library is really easy to use:```python
from supermail import EmailClient# define email client
gmail = EmailClient("[email protected]", "your_password")# get all messages
messages = gmail.read() # if you need only unread, set parameter filter=['UNSEEN']# for each message
for msg in messages:
# get message info
print(msg.subject())
print(msg.message())
print(msg.sender())
# get attachments
attachments = msg.attachments('./temp') # returns a list of filenames saved in specified dir# send a message with attachments
gmail.send('[email protected]', 'Nice subject', 'Nice message', \
cc='[email protected]',
attachments=['/path/to/pdf.pdf', '/path/to/image.png'])
```## Note
In order to use GMail, you need to log into [your security page](https://myaccount.google.com/security) and:
1. enable two-step verification
2. right below, it will appear an option called **App Password**. Create a new one that you will be able to use with supermail.## Other email? No problem!
You can specify custom imap and smtp addresses and ports:```python
email_address = "[email protected]"
email_pwd = "your_password"
imap_server = "imap.gmail.com"
imap_port = 993
smtp_server='smtp.gmail.com'
smtp_port=587# define email client
gmail = EmailClient(email_address, email_pwd, imap_server, imap_port, smtp_server, smtp_port)
```## Install
You can install supermail from PyPI:
```bash
pip install supermail
```or from the github page:
```bash
pip install git+https://github.com/dros1986/EmailClient.git
```