Adding Multiple Attachments to SMTP mail (msg.add_header)

Christos Georgiou tzot at sil-tec.gr
Sat Mar 18 07:52:08 EST 2006


On 10 Mar 2006 06:08:37 -0800, rumours say that "EdWhyatt"
<ed.whyatt at gmail.com> might have written:

>I attach my code for passing the information to  msg.add_header:
>
>(AttNum = 2)
>
>            for doatt in range(AttNum):
>                msg.add_header('Content-Disposition', 'attachment',
>filename=ATTselection[doatt])
>                doatt = doatt + 1
>                outer.attach(msg)
>
>......
>    body = MIMEText(Text)
>    outer.attach(body)
>
>Like I said, it is correctly sending the 2 seperate files from my
>ATTselection array, but ultimately attaching the last file twice.

The {doatt = doatt + 1} line is unneeded in the {for doatt in} loop.  This
*might* be your problem, I didn't delve any deeper.
-- 
TZOTZIOY, I speak England very best.
"Dear Paul,
please stop spamming us."
The Corinthians



More information about the Python-list mailing list