-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsendmail.py
38 lines (29 loc) · 1.02 KB
/
sendmail.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
#!/usr/local/bin/python3.5
# coding=gbk
from email.mime.text import MIMEText
from smtplib import SMTP_SSL
import time
import warnings
warnings.filterwarnings("ignore")
msg = MIMEText('hello,send by Python...','html','utf-8')
mail_info = {
'From':'[email protected]',
'Password':'aotofx1234',
'To':'[email protected]',
'Mail_server':'smtp.163.com',
}
if __name__ == '__main__':
smtp = SMTP_SSL(mail_info['Mail_server'])
smtp.ehlo(mail_info['Mail_server'])
smtp.login(mail_info['From'],mail_info['Password'])
str = 'AOTOFX部分产品保证金政策调整通知...'
msg = MIMEText(str,'html','utf-8')
msg['Subject'] = 'AOTO FX 部分产品保证金政策调整通知'
msg['From'] = mail_info['From']
msg['To'] = mail_info['To']
arr = ['[email protected]','[email protected]']
for to in arr:
smtp.sendmail(mail_info['From'], to, msg.as_string())
print(to)
time.sleep(10.0)
smtp.quit()