Skip to content

Commit 85f6006

Browse files
author
tuntun
committed
Python发送邮件示例
1 parent 55806ce commit 85f6006

1 file changed

Lines changed: 0 additions & 25 deletions

File tree

sendMail.py

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +0,0 @@
1-
import smtplib
2-
from email.mime.text import MIMEText
3-
from email.mime.multipart import MIMEMultipart
4-
5-
SERVER = "smtp.qq.com"
6-
7-
COMMASPACE = ', '
8-
9-
# Create the container (outer) email message.
10-
msg = MIMEMultipart()
11-
msg['Subject'] = 'Our family reunion'
12-
13-
14-
msg['From'] = FROM
15-
msg['To'] = COMMASPACE.join(TO)
16-
17-
text = 'hello,world!'
18-
part1 = MIMEText(text, 'plain')
19-
# part2 = MIMEText(html, 'html')
20-
msg.attach(part1)
21-
msg.preamble = 'Our family reunion'
22-
server = smtplib.SMTP(SERVER)
23-
server.login('[email protected]', 'pwd')
24-
server.sendmail(FROM, TO, msg.as_string())
25-
server.quit()

0 commit comments

Comments
 (0)