Skip to content

Commit 1b7624e

Browse files
authored
Add files via upload
1 parent 4e2c50b commit 1b7624e

File tree

3 files changed

+109
-0
lines changed

3 files changed

+109
-0
lines changed

MANIFEST.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
include README.md LICENSE

gmail/gmail.py

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
__author__ = 'Sujit Mandal'
2+
#Date : 07-09-2020
3+
import smtplib
4+
5+
'''
6+
# Author : Sujit Mandal
7+
Github : https://github.com/sujitmandal
8+
Pypi : https://pypi.org/user/sujitmandal/
9+
LinkedIn : https://www.linkedin.com/in/sujit-mandal-91215013a/
10+
'''
11+
12+
#E-mail login credential
13+
gmail_id = ('') #sender g-mail id
14+
password = ('') #sender g-mail password
15+
16+
#reciver mail id's
17+
reciver_mail_id = [
18+
19+
20+
21+
'............................',
22+
'.............................',
23+
'reciver_mail_id_N [email protected]',
24+
]
25+
#main subject
26+
subject = ('') #mail subject
27+
#mail contain
28+
mail_contain = ('') #mail contain
29+
30+
31+
class loginCredential:
32+
def login(self,gmail_id, password):
33+
self.gmail_id = gmail_id
34+
self._password = password
35+
36+
server = smtplib.SMTP('smtp.gmail.com', 587)
37+
server.ehlo()
38+
server.starttls()
39+
server.ehlo()
40+
server.login(self.gmail_id, self._password)
41+
return(server)
42+
43+
class reciverCredential(loginCredential):
44+
def reciver_mail(self, reciver_mail_id):
45+
self.reciver_mail_id =reciver_mail_id
46+
47+
mail_id = []
48+
for i in reciver_mail_id:
49+
mail_id.append(i)
50+
return(mail_id)
51+
52+
class gmail(reciverCredential):
53+
def send_mail(self, subject, mail_containt):
54+
server = self.login(self.gmail_id, self._password)
55+
reciver_mail_id = self.reciver_mail(self.reciver_mail_id)
56+
57+
containt = (f'subject: {subject}\n\n{mail_containt}')
58+
59+
server.sendmail(
60+
self.gmail_id,
61+
reciver_mail_id,
62+
containt
63+
)
64+
if len(reciver_mail_id) == 1:
65+
print('Mail has been sent to this : {}'.format(reciver_mail_id),'Address.')
66+
else:
67+
print('Mail has been sent to these : {}'.format(reciver_mail_id),'Address.')
68+
server.quit()
69+
70+
71+
72+
if __name__ == '__main__':
73+
mail = gmail()
74+
mail.login(gmail_id, password)
75+
mail.reciver_mail(reciver_mail_id)
76+
mail.send_mail(subject, mail_contain)

setup.py

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
__author__ = 'Sujit Mandal'
2+
#Date : 30-08-2020
3+
from setuptools import setup
4+
5+
def readme():
6+
with open('README.md') as files:
7+
README = files.read()
8+
9+
return(README)
10+
11+
setup(
12+
name = 'py-gmail',
13+
version = '0.0.5',
14+
description = 'Automatically Send Gmail with SMTP Server.',
15+
long_description = readme(),
16+
long_description_content_type = 'text/markdown',
17+
url = 'https://github.com/sujitmandal/py-gmail',
18+
author = 'Sujit Mandal',
19+
author_email = '[email protected]',
20+
license = 'MIT',
21+
classifiers = [
22+
'License :: OSI Approved :: MIT License',
23+
'Programming Language :: Python :: 2.7',
24+
'Programming Language :: Python :: 3.0',
25+
'Programming Language :: Python :: 3.6',
26+
'Programming Language :: Python :: 3.7',
27+
'Programming Language :: Python :: 3.8',
28+
],
29+
30+
packages = ['gmail'],
31+
include_package_data = True,
32+
)

0 commit comments

Comments
 (0)