sending ftp file list to mail???

selahattin ay selahattin_ay at msn.com
Fri Oct 7 02:23:57 EDT 2011


hi all. I want to get my ftp list and send the list to my mail adress... my codes are
from ftplib import FTP
import smtplib
from email.MIMEMultipart import MIMEMultipart
from email.MIMEText import MIMETextbaglanti = FTP("ftp.guncelyorum.org")
baglanti.login("******", "*******")
print baglanti.dir()
posta = MIMEMultipart()def posta_olustur():
    posta['Subject']=konu
    posta['From']=gmail_kullanici
    posta['To']=kime
    posta.attach(MIMEText(baglanti.retrlines("LIST")))      <------ what can I do for here 
    
def posta_gonder():
    smtpserver = smtplib.SMTP("smtp.gmail.com",587)
    smtpserver.ehlo()
    smtpserver.starttls()
    smtpserver.ehlo
    smtpserver.login(gmail_kullanici, gmail_sifre)
    print "baglanti saglandi"
    smtpserver.sendmail(gmail_kullanici, kime, posta.as_string())
    print "Posta Gonderildi"
    smtpserver.close()
 # mail to   
kime = raw_input("Kime gonderecesiniz?: ") 
# gmail user namegmail_kullanici = raw_input("gmail kullanici adiniz: ")
#gmail passgmail_sifre = raw_input("Gmail sifreniz: ")
#subjectkonu = raw_input ("Posta Konusu: ")
posta_olustur()
posta_gonder()

 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20111007/7129b0d2/attachment.html>


More information about the Python-list mailing list