En Fri, 07 Oct 2011 03:23:57 -0300, selahattin ay <selahattin...@msn.com> escribió:

hi all. I want to get my ftp list and send the list to my mail adress... my codes are

baglanti = 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

Ah, I didn't notice that part.
MIMEText expects a string. retrlines, by default, outputs to stdout, isn't very useful. Try this:

def posta_olustur():
  ...
  lines = []
  baglanti.retrlines("LIST", lines.append)
  text = '\n'.join(lines)
  posta.attach(MIMEText(text))



--
Gabriel Genellina

--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to