-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathE-mail.py
More file actions
52 lines (26 loc) · 977 Bytes
/
E-mail.py
File metadata and controls
52 lines (26 loc) · 977 Bytes
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
import smtplib
from email.mime.text import MIMEText
import time
mail_server = "XXX.XXX.com"#邮件提供商的smtp(上网去查查)
mail_port = 2
sender = "ljy123ljy123@dingtalk.com"#你的邮箱
sender_password = "xxxxxx" #授权码,不一定是密码
receivers="1wh-zddx650ixl@dingtalk.com" # input("receivers接收者邮箱:")
mytxt=input("text发送的文本:")
req=int(input("times邮件发送次数:"))
message = MIMEText(mytxt, 'plain', 'utf-8')
message['From'] = sender
message['To'] = receivers
message['Subject'] = input("Subject主题:")
a=0
while a<req:
try:
smtp_obj = smtplib.SMTP()
smtp_obj.connect(mail_server, mail_port)
smtp_obj.login(sender, sender_password)
smtp_obj.sendmail(sender, [receivers], message.as_string())
print('success!')
except smtplib.SMTPException as e:
print('failure!')
print(e)
a+=1