Найти - Пользователи
Полная версия: POP3 to SMTP Forwarder
Начало » Network » POP3 to SMTP Forwarder
1 2
utu2012
igor.kaist
посмотрите на модуль email, может быть проще станет… http://docs.python.org/library/email-examples.html
Модуль email работает с string, как правильно от poplib получить string?
pyuser
utu2012
Получить письмо я могу, и отправить могу…
тогда не понятно, в чем проблема :)
client = poplib.POP3(pop_host)
client.user(user)
client.pass_(passwd)
answ, lines, tmp = client.retr(1)
client.quit()

msg = email.message_from_string(str(b"\n".join(lines), "ascii", "ignore"))

s = smtplib.SMTP(smtp_host)
msg["To"] = 'почтовый ящик "В"'
s.sendmail(msg['From'], addr, msg.as_string())
s.quit()
utu2012
Спасибо !
Вот то что нужно:
msg = email.message_from_string(str(b"\n".join(lines), "ascii", "ignore"))
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Powered by DjangoBB