-
Notifications
You must be signed in to change notification settings - Fork 0
/
mail.py
57 lines (49 loc) · 1.89 KB
/
mail.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#!/usr/bin/env python3
#coding: utf-8
import smtplib
from email.mime.text import MIMEText
from email.header import Header
def newmail(newmsg):
sender = 'meet_mrfruit@163.com'
receiver = '574959828@qq.com'
subject = 'mrfruit users message'
smtpserver = 'smtp.163.com'
username = 'meet_mrfruit'
password = 'mrfruit4142'
msg = MIMEText(newmsg,'plain','utf-8')#ä¸æ–‡éœ€å‚数‘utf-8’,å•å—节å—符ä¸éœ€è¦?
msg['Subject'] = Header(subject, 'utf-8')
smtp = smtplib.SMTP()
smtp.connect('smtp.163.com')
smtp.login(username, password)
smtp.sendmail(sender, receiver, msg.as_string())
smtp.quit()
def sendmail(row):
sender = 'meet_mrfruit@163.com'
receiver = row[1]
subject = '您在mrfruit的本周订å•ï½ž'
smtpserver = 'smtp.163.com'
username = 'meet_mrfruit'
password = 'mrfruit4142'
newmsg="您本周在mrfruit的水果订å•å·²ç»ç”Ÿæˆï¼Œç‚¹å‡»æ¤é“¾æŽ¥æŸ¥çœ‹ï¼š<br>"+"http://42.121.2.44:8888/weekly/"+row[0]
msg = MIMEText(newmsg,'html','utf-8')#ä¸æ–‡éœ€å‚数‘utf-8’,å•å—节å—符ä¸éœ€è¦?
msg['Subject'] = Header(subject, 'utf-8')
smtp = smtplib.SMTP()
smtp.connect('smtp.163.com')
smtp.login(username, password)
smtp.sendmail(sender, receiver, msg.as_string())
smtp.quit()
def sendmailto(row):
sender = 'meet_mrfruit@163.com'
receiver = row[1]
subject = '您在mrfruit的明天订å•ï½ž'
smtpserver = 'smtp.163.com'
username = 'meet_mrfruit'
password = 'mrfruit4142'
newmsg="您在mrfruit订的水果明天就è¦åˆ°äº†ï¼Œç‚¹å‡»æ¤é“¾æŽ¥æŸ¥çœ‹ï¼?br>"+"http://42.121.2.44:8888/daily/"+row[0]
msg = MIMEText(newmsg,'html','utf-8')#ä¸æ–‡éœ€å‚数‘utf-8’,å•å—节å—符ä¸éœ€è¦?
msg['Subject'] = Header(subject, 'utf-8')
smtp = smtplib.SMTP()
smtp.connect('smtp.163.com')
smtp.login(username, password)
smtp.sendmail(sender, receiver, msg.as_string())
smtp.quit()