Skip to content

Commit 6c1e5eb

Browse files
author
goyanip
authored
Add files via upload
1 parent dec491e commit 6c1e5eb

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

mail.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import smtplib
2+
import getpass
3+
4+
to = raw_input("Enter Receipient: " )
5+
servername = raw_input("Enter Mail Server: ")
6+
username = raw_input("Enter Your Email: ")
7+
password = getpass.getpass("%s's password: " % username)
8+
subject = """Subject: SMTP Test Mail
9+
This is a Test mail message..
10+
"""
11+
12+
server = smtplib.SMTP(servername,587)
13+
try:
14+
server.set_debuglevel(True)
15+
server.ehlo()
16+
if server.has_extn('STARTTLS'):
17+
server.starttls()
18+
server.ehlo()
19+
20+
server.login(username, password)
21+
server.sendmail(username, to, subject)
22+
finally:
23+
server.quit()

0 commit comments

Comments
 (0)