Skip to content

Email Client for reading and sending emails.

Notifications You must be signed in to change notification settings

CeLuigi/EmailClient

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Installation via pip

pip install git+https://github.com/dros1986/EmailClient.git

Usage

This library is really easy to use:

from EmailClient import EmailClient

email_address = "your_email@gmail.com"
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)

# get all messages
messages = gmail.read() # if you need only unread, set 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
	print('---')

# send a message with attachments
gmail.send('recipient@gmail.com', 'Nice subject', 'Nice message', \
	cc='xxx@domain.it',
	attachments=['/path/to/pdf.pdf', '/path/to/image.png'])

Include it in your git project as submodule

To include EmailClient in your project:

git submodule add https://github.com/dros1986/EmailClient.git

Remember when cloning your project in another place to use --recursive flag:

git clone --recursive <your_git_repo>

Note

In order to use GMail, you need to enable less secure apps at this link.

About

Email Client for reading and sending emails.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%