SMTPlib Emailing Attachments

Rudy Schockaert rudy.schockaert at pandora.be
Sat Sep 20 06:26:16 EDT 2003


Bill wrote:
> Karl Scalet <news at yebu.de> wrote in message news:<bkf0nd$10dm0$1 at ID-141451.news.uni-berlin.de>...
> 
>>Bill wrote:
>>
>>
>>>[...]
>>>path = 'C:\\YourPath\\YourFile.txt'
>>>filename = 'YourFile.txt'
>>
>>is this correct? Shouldn't path contain the directory only?
>>Otherwise what's the content of YourFile.txt then.
>>
>>Karl
> 
> 
> Well I believe you need the file as well b/c the mimetypes function
> checks the extension to see what type of file it is. I am sure you can
> modify it to be more efficient. But it works as is.

Path and filename are two distinct items. The first points to the 
physical file, the other is the name the attachment will get in the mail.
This way you also have the flexibility to name the file once attached 
different than the version on disk.





More information about the Python-list mailing list