Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
mustafamuratcoskun
GitHub Repository: mustafamuratcoskun/Sifirdan-Ileri-Seviyeye-Python-Programlama
Path: blob/master/İleri Seviye Modüller/Videolarda Kullanılan Kodlar/Smtp Modülü/Mail_Gonderme.py
765 views
1
import smtplib
2
from email.mime.multipart import MIMEMultipart
3
from email.mime.text import MIMEText
4
import sys
5
6
mesaj = MIMEMultipart()
7
8
mesaj["From"] = "[email protected]"
9
10
mesaj["To"] = "[email protected]"
11
12
mesaj["Subject"] = "Smtp Mail Gönderme"
13
14
15
yazi = """
16
17
Smtp ile mail gönderiyorum.
18
19
Mustafa Murat Coşkun
20
21
22
"""
23
24
25
mesaj_govdesi = MIMEText(yazi,"plain")
26
27
mesaj.attach(mesaj_govdesi)
28
29
try:
30
mail = smtplib.SMTP("smtp.gmail.com",587)
31
32
mail.ehlo()
33
34
mail.starttls()
35
36
mail.login("","")
37
38
mail.sendmail(mesaj["From"],mesaj["To"],mesaj.as_string())
39
40
print("Mail Başarıyla Gönderildi....")
41
42
mail.close()
43
44
except:
45
sys.stderr.write("Bir sorun oluştu!")
46
sys.stderr.flush()
47
48
49
50
51
52
53
54
55