stackoverflow artık yuvam olduIs it possible to save the sent email into the sent items folder using python?
I want to sends an email but sent mail is empty. how to send an email, and then put a copy of it in the "Sent" mail folder. what can i do?stackoverflow.com
Bu kaynağa göz atar mısın?
kullan işte n'olcakdaha basit kod yok mu
ben kullanırım anlarımda bi arkadaşım anlamazkullan işte n'olcak
bu yüzden daha basit kod atınız lütfenIs it possible to save the sent email into the sent items folder using python?
I want to sends an email but sent mail is empty. how to send an email, and then put a copy of it in the "Sent" mail folder. what can i do?stackoverflow.com
Bu kaynağa göz atar mısın?
python kodlarıyla klasör nasıl atılır python kodlarıyla atın lütfen.basit olsun lütfen
import smtplib
from email.MIMEMultipart import MIMEMultipart
from email.MIMEBase import MIMEBase
from email.MIMEText import MIMEText
from email import Encoders
import os
smtp_server = "DOLDURUN" # Giden posta sunucusu
port = DOLDURUN # Sunucu port ayarı
user = "DOLDURUN" # Kullanıcı adı
pwd = "DOLDURUN" # Parola
name = "DOLDURUN" # Alias ID
alias = "" + name # Nickname
path = "DOLDURUN" # Split edilmiş dosyaların bulunduğu klasör
destination = "DOLDURUN" # Dosyaların gönderileceği e-posta adresi
text = "DOLDURUN" # E-postanın mesajın gövdesi
# Mecbur kalmadıkça bu noktadan sonra değişiklik yapmayın.
class mail_sender:
def __init__(self):
self.liste = os.listdir(path)
def login(self):
print("Sunucuya giris yapiliyor...")
self.mailServer = smtplib.SMTP(smtp_server, port)
self.mailServer.set_debuglevel(1)
self.mailServer.ehlo()
self.mailServer.starttls()
self.mailServer.ehlo()
self.mailServer.login(user, pwd)
print("Sunucuya basariyla giris yapildi.\n")
def logout(self):
self.mailServer.close()
def begin(self):
self.login()
while(self.liste):
self.liste = os.listdir(path)
self.dosya = self.dosyasec()
print(self.dosya + ' secildi.')
self.send()
self.logout()
def dosyasec(self):
return self.liste.pop(0)
def mailprep(self):
mail = MIMEMultipart()
mail['From'] = alias
mail['To'] = destination
mail['Subject'] = self.dosya # E-postanın konu kısmı = gönderilen dosyanın ismi
mail.attach(MIMEText(text))
part = MIMEBase('application', 'octet-stream')
part.set_payload(open(path + os.sep + self.dosya, 'rb').read())
Encoders.encode_base64(part)
part.add_header('Content-Disposition','attachment; filename="%s"' % self.dosya)
mail.attach(part)
return mail
def send(self):
newmail = self.mailprep()
self.mailServer.sendmail(user, destination, newmail.as_string())
# winsound.PlaySound("SystemExit", winsound.SND_ALIAS)
print('E-posta yollandi. Dosya = ' + self.dosya)
os.remove(path + os.sep + self.dosya)
print(self.dosya + ' silindi.')
print('\n')
a = mail_sender()
a.begin()
bufrom email.MIMEMultipart import MIMEMultipart from email.MIMEBase import MIMEBase from email.MIMEText import MIMEText from email import Encoders
peki kütüphanelerin yüklemesini de yazar mısınız? windows 10 işletim sistemiPython:import smtplib from email.MIMEMultipart import MIMEMultipart from email.MIMEBase import MIMEBase from email.MIMEText import MIMEText from email import Encoders import os smtp_server = "DOLDURUN" # Giden posta sunucusu port = DOLDURUN # Sunucu port ayarı user = "DOLDURUN" # Kullanıcı adı pwd = "DOLDURUN" # Parola name = "DOLDURUN" # Alias ID alias = "" + name # Nickname path = "DOLDURUN" # Split edilmiş dosyaların bulunduğu klasör destination = "DOLDURUN" # Dosyaların gönderileceği e-posta adresi text = "DOLDURUN" # E-postanın mesajın gövdesi # Mecbur kalmadıkça bu noktadan sonra değişiklik yapmayın. class mail_sender: def __init__(self): self.liste = os.listdir(path) def login(self): print("Sunucuya giris yapiliyor...") self.mailServer = smtplib.SMTP(smtp_server, port) self.mailServer.set_debuglevel(1) self.mailServer.ehlo() self.mailServer.starttls() self.mailServer.ehlo() self.mailServer.login(user, pwd) print("Sunucuya basariyla giris yapildi.\n") def logout(self): self.mailServer.close() def begin(self): self.login() while(self.liste): self.liste = os.listdir(path) self.dosya = self.dosyasec() print(self.dosya + ' secildi.') self.send() self.logout() def dosyasec(self): return self.liste.pop(0) def mailprep(self): mail = MIMEMultipart() mail['From'] = alias mail['To'] = destination mail['Subject'] = self.dosya # E-postanın konu kısmı = gönderilen dosyanın ismi mail.attach(MIMEText(text)) part = MIMEBase('application', 'octet-stream') part.set_payload(open(path + os.sep + self.dosya, 'rb').read()) Encoders.encode_base64(part) part.add_header('Content-Disposition','attachment; filename="%s"' % self.dosya) mail.attach(part) return mail def send(self): newmail = self.mailprep() self.mailServer.sendmail(user, destination, newmail.as_string()) # winsound.PlaySound("SystemExit", winsound.SND_ALIAS) print('E-posta yollandi. Dosya = ' + self.dosya) os.remove(path + os.sep + self.dosya) print(self.dosya + ' silindi.') print('\n') a = mail_sender() a.begin()
import yagmail
yag = yagmail.SMTP("Mail Adresiniz", "Mail Şifreniz")
yag.send(
to = "alıcı@domain.uzantı",
subject = "Mail Başlığı",
contents = "Mail İçeriği",
attachments = "Dosya/Yolu"
)
bu
peki kütüphanelerin yüklemesini de yazar mısınız? windows 10 işletim sistemi
Turkhackteam.org internet sitesi 5651 sayılı kanun’un 2. maddesinin 1. fıkrasının m) bendi ile aynı kanunun 5. maddesi kapsamında "Yer Sağlayıcı" konumundadır. İçerikler ön onay olmaksızın tamamen kullanıcılar tarafından oluşturulmaktadır. Turkhackteam.org; Yer sağlayıcı olarak, kullanıcılar tarafından oluşturulan içeriği ya da hukuka aykırı paylaşımı kontrol etmekle ya da araştırmakla yükümlü değildir. Türkhackteam saldırı timleri Türk sitelerine hiçbir zararlı faaliyette bulunmaz. Türkhackteam üyelerinin yaptığı bireysel hack faaliyetlerinden Türkhackteam sorumlu değildir. Sitelerinize Türkhackteam ismi kullanılarak hack faaliyetinde bulunulursa, site-sunucu erişim loglarından bu faaliyeti gerçekleştiren ip adresini tespit edip diğer kanıtlarla birlikte savcılığa suç duyurusunda bulununuz.