-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathslanje_mejla.py
39 lines (36 loc) · 1.4 KB
/
slanje_mejla.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
import os, sys
import smtplib
def sendmail(adresa, msg, sbj = "BANKA"):
clear = ('cls' if os.name == 'nt' else 'clear')
try:
try:
server = smtplib.SMTP('smtp.gmail.com', 587)
print ("Molimo sačekajte...")
server.starttls()
server.login("sendermail112@gmail.com", "SenderMail123")
os.system(clear)
print ("Molimo sačekajte....")
message = 'Subject: {}\n\n{}'.format(sbj, msg)
server.sendmail("sendermail112@gmail.com", adresa, message)
os.system(clear)
print ("Molimo sačekajte.....")
server.sendmail("sendermail112@gmail.com",str(adresa)+"\n"+str(msg))
os.system(clear)
print ("Molimo sačekajte......")
server.quit()
return True
except Exception:
server = smtplib.SMTP('smtp.gmail.com', 587)
os.system(clear)
print ("Molimo sačekajte.....")
server.starttls()
server.login("sendermail112@gmail.com", "SenderMail123")
os.system(clear)
print ("Molimo sačekajte......")
server.sendmail("sendermail112@gmail.com", str(adresa)+"\n"+str(msg))
os.system(clear)
print ("Molimo sačekajte.......")
server.quit()
return "Pogrešan mail"
except Exception:
return ""