A Python interface to interact with gmail.
Project description
.active, .collapsible:hover {
background-color: #555;
}
.collapsible:after {
content: '\002B';
color: white;
font-weight: bold;
float: right;
margin-left: 5px;
}
.active:after {
content: "\2212";
}
.content {
padding: 0 18px;
max-height: 0;
overflow: hidden;
transition: max-height 0.2s ease-out;
background-color: #f1f1f1;
}
</style>
<script>
var coll = document.getElementsByClassName("collapsible");
var i;
for (i = 0; i < coll.length; i++) {
coll[i].addEventListener("click", function() {
this.classList.toggle("active");
var content = this.nextElementSibling;
if (content.style.maxHeight){
content.style.maxHeight = null;
} else {
content.style.maxHeight = content.scrollHeight + "px";
}
});
}
</script>
</head>
<body>
<h1>emailpy</h1>
<h2>A Python interface for sending, reading, and deleting emails </h2>
<button class='collapsible'>Classes</button>
<div class='content'>
<ul>
<li>EmailReader - email reader</li>
<li>EmailSender - email sender</li>
<li>EmailManager - email manager</li>
</ul>
</div>
<button class='collapsible'>Functions</button>
<div class='content'>
<ul>
<li>readmail - read an email</li>
<li>sendmail - send an email</li>
<li>sendmailobj - send an EmailMessage object with changable specs. </li>
<li>forward - forward an EmailMessage object with changable specs. </li>
<li>genzoominvite - generate a Zoom Meeting invite</li>
<li>sendzoominvite - send a Zoom Meeting invite</li>
<li>getfoldernames - get all folder names in your email</li>
<li>createfolder - create an email folder</li>
<li>deletefolder - delete an email folder</li>
</ul>
</div>
<button class='collapsible'>Updates</button>
<div class='content'>
<ul>
<li>Now will automatically sort emails by date</li>
<li>The EmailReader, EmailSender, and EmailManager classes. You now only have to mention your email password once, using the EmailManager class.
</ul>
</div>
<button class='collapsible'>To be Released in Future Release</button>
<div class='content'>
<ul>
<li>Support for Evites</li>
<li>Support for Paperless Posts</li>
</ul>
</div>
<button class='collapsible'>Usage</button>
<div class='content'>
<pre>
import emailpy # import the emailpy package manager = emailpy.EmailManager('emailmanager@gmail.com', 'password') # create EmailManager object (for security reasons)
Use the EmailManager docs to continue.
</pre>
</div>
<button class='collapsible'>EmailReader Class</button>
<div class='content'>
<pre>
from emailpy import EmailReader # import the EmailReader class from the emailpy package reader = EmailReader('emailreader@gmail.com', 'password') # create EmailReader object foldernames = reader.getfoldernames() # get email folder names data = reader.read(foldername = foldernames[0]) # read emails from
the first folder name in foldernames
if data: # check if data has any value
for msg in data: # iter through all emails in data
print(msg.subject, '\r\n', msg.sender, msg.recvers,
msg.date, '\r\n', msg.body, '\r\n',
msg.attachments) # print email info
print('\r\n', '\r\n')
reader.createfolder("folder")
print('Created Email Folder named "folder". ')
reader.deletefolder("folder")
print('Deleted Email Folder named "folder". ')
print('done')
EmailSender Class
from emailpy import EmailSender # import the EmailSender class from the emailpy package sender = EmailSender('emailsender@outlook.com', 'password') # create EmailReader object sender.send(['email@hotmail.com', 'email@yahoo.com'], subject = 'Subject', body = 'body text', html = '<html><h1>This is some html!</h1></html>', attachments = ['file.txt', 'image.jpg'], nofileattach = {'other_file.txt': 'some data'})
from emailpy import EmailManager # import the EmailManager class from the emailpy package manager = EmailManager('emailmanager@outlook.com', 'password') # create EmailManager objectthe EmailManager Class is basically a combination of the EmailReader and EmailSender classes. You can treat the EmailManager class just like you would treat the
EmailReader or EmailSender Classes. Use the EmailReader and EmailSender docs for how to use the EmailManager Class.
</pre> </div> <pre>
It is suggested to use only the EmailManager class, and none of the functions, because the EmailManager class has all the functions and simplified all of the functions too.
</pre> <button class='collapsible'>Zoom Invite Emails</button> <div class='content'> <h3>Zoom Invite Emails</h3> <h4>Handling Zoom Invite Emails</h4> <pre>
if email.is_zoom: print('Email is Zoom invite Link!') print('The meeting url is', email.zoomurl) print('The meeting id is', email.zoomid) print('The meeding password is', email.zoompwd) if input('Join Zoom Meeting? (y/n)').lower() == 'y': email.openzoom() else: print('Email is not Zoom invite link. ')
for (i = 0; i < coll.length; i++) {
coll[i].addEventListener("click", function() {
this.classList.toggle("active");
var content = this.nextElementSibling;
if (content.style.maxHeight){
content.style.maxHeight = null;
} else {
content.style.maxHeight = content.scrollHeight + "px";
}
});
}
</script>
</body>
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.