How to define a name of attachment in email with python ?
fowlertrainer at anonym.hu
fowlertrainer at anonym.hu
Thu May 27 08:10:47 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 ?
>
> Thanx for it:
> FT
>
I help to me - I found some information in Delphi mail headers :-) :
The solution is this:
fp=open(sf, 'r')
mdata=MIMEText(fp.read(),'plain','iso-8859-2')
fp.close()
mdata.add_header('content-disposition', 'attachment',
filename=GetFileName(sf))
msg.attach(mdata)
Thanx for me.
FT
More information about the Python-list
mailing list