forked from raghupatelraj/test_repo
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmail.py
More file actions
21 lines (19 loc) · 647 Bytes
/
Copy pathmail.py
File metadata and controls
21 lines (19 loc) · 647 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import smtplib
import email.utils
from email.mime.text import MIMEText
# Create the message
msg = MIMEText('very happy to write the mail')
msg['To'] = email.utils.formataddr(('ramya', 'v.ramyanaidu.v@gmail.com'))
msg['From'] = email.utils.formataddr(('ramyanaidu', 'ramyanaidu1458@gmail.com'))
msg['Subject'] = 'test mail'
print "hi"
server = smtplib.SMTP('mail')
print "hello"
server.set_debuglevel(True) # show communication with the server
print "good morning"
try:
print "before sending mail"
server.sendmail('ramyanaidu1458@gmail.com', ['v.ramyanaidu.v@gmail.com'], msg.as_string())
print "sent mail"
finally:
server.quit()