Re: Adding Multiple Attachments to SMTP mail (msg.add_header)
On 10 Mar 2006 06:08:37 -0800, rumours say that EdWhyatt [EMAIL PROTECTED] 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 -- http://mail.python.org/mailman/listinfo/python-list
Adding Multiple Attachments to SMTP mail (msg.add_header)
Hi all, I hope there is someone out there who can help me out - it has to be something obvious. I am simulating mail traffic, and want to include multiple attachments to my mail. I have created a temporary array containing a number of files - for now just 2. Debugging my code, I can see that I am correctly storing the files in the array, and then 1 by 1 adding one file at a time to the message header. When the program is complete, the resultant mail has 2 attachments, as hoped. However, it is the second file attached twice, rather than the two unique files. 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. If anyone can help/suggest something please please let me know! Thanks, Ed -- http://mail.python.org/mailman/listinfo/python-list
Re: Adding Multiple Attachments to SMTP mail (msg.add_header)
EdWhyatt wrote: Hi all, I hope there is someone out there who can help me out - it has to be something obvious. I am simulating mail traffic, and want to include multiple attachments to my mail. I have created a temporary array containing a number of files - for now just 2. Debugging my code, I can see that I am correctly storing the files in the array, and then 1 by 1 adding one file at a time to the message header. When the program is complete, the resultant mail has 2 attachments, as hoped. However, it is the second file attached twice, rather than the two unique files. 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. If anyone can help/suggest something please please let me know! Thanks, Ed Take a look at the following: http://motion.sourceforge.net/related/send_jpg.py http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/52243 Larry Bates -- http://mail.python.org/mailman/listinfo/python-list