[Python] Problema Mail : Missing required header field: "Date"

Riccardo Brazzale riccardo.brazzale a gmail.com
Ven 16 Ott 2015 08:57:24 CEST


Ciao a tutti.

Premetto che non so se il problema sta dalla parte di python ma ci provo,
non vorrei che bastasse un niente sul codice e il problema scompare....

Ho questo programma che manda a destra e a manca dei documenti pdf:

msg = MIMEMultipart()
msg['From'] = mailfrom
msg['To'] = to
msg['Subject'] = subject
part = MIMEBase('application', 'octet-stream')
part.set_payload(open(attach, 'rb').read())
Encoders.encode_base64(part)
part.add_header('Content-Disposition',
                       'attachment; filename="%s"' %
os.path.basename(attach))
testa = text
piede = footer
part1 = MIMEText(testa, 'html')
part2 = MIMEText(piede, 'html')
msg.attach(part)
msg.attach(part1)
msg.attach(part2)
server.sendmail(mailusername, to, msg.as_string())
server.quit()

Ho dei rarissimi casi in cui mi torna questo:

The message WAS NOT relayed to:

<abcd a acme.com <info a bizeta-macchinehf.it>>:

554 5.6.0 bounce, id=24119-12 - bad header

This nondelivery report was generated by the program amavisd-new at host

s2.asws3.com. Our internal reference code for your message is

24119-12/qf8Mkr96lFAq

INVALID HEADER
Missing required header field: "Date"

Googlando in giro ho trovato che amavisd fa di queste cose ma non ho
trovato un workaround per risolvere tranne quello che il destinatario debba
mettere le mani sulle configurazioni di spamassasin e amavisd.

Ho qualche speranza?

Grazie

-- 
Riccardo Brazzale
-------------- parte successiva --------------
Un allegato HTML è stato rimosso...
URL: <http://lists.python.it/pipermail/python/attachments/20151016/a319209a/attachment.html>


Maggiori informazioni sulla lista Python