How to define a name of attachment in email with python ?
Peter Hansen
peter at engcorp.com
Thu May 27 08:39:46 EDT 2004
fowlertrainer at anonym.hu wrote:
> I want to set the name of the attachment in an python-generated email.
>
> This is needed, because the another site we want to get this name, and
> repack the attachments by name (an ID).
>
> Some programming languges (components) are allow to set this.
> (See Delphi/Indy/MessagePart)
>
> fp=open(plist[i], 'rb')
> mdata=MIMEAudio(fp.read(),'mpeg')
> fp.close()
> msg.attach(mdata)
> ???? msg['filename']='xxx'
>
> Can anyone help in this problem ?
Yes, read the manual: the online documentation of the email
module has some examples. The last example shows how to set
the filename (using msg.add_header() to set the Content-
Disposition header).
-Peter
More information about the Python-list
mailing list