From: "Dan Muey" <[EMAIL PROTECTED]> > I have a script that generates a pdf file from html. > > It generates it for viewing perfect. > It will email it also. > > However when I email it a .dat extension is added and it won;t work in > Acrobat.
I bet it's the mail client who adds the .dat extension, not Mail::Sender. > If I view the source of the view version and viwe the source of the > dat file they seem to be identicle. The html is generated on the fly > based on databads enetries and then the pdf code is created form that > using the program htmldoc. > > If I just remove the extension so it's a .pdf file Acrobat still can't > read it. > > Is there any way to specify what the attached file name should be with > out it adding the .dat ? What am I missing? > > Thanks > Dan > > Here is my code : > > # works great > print "Content-type: application/pdf\n\n"; > print $contract_html_pdf; > exit; > > # works good except for it sends 'Infiniplex.pdf.dat' instead of > # Infiniplex.pdf > > $sender = new Mail::Sender {smtp => "$smtp_serv", from => > "$from"}; > $sender->OpenMultipart({subject => "$subject", to => > "$email_to"}); $sender->Body({ > ctype => 'text/plain', > msg => "$text" > }); > $sender->Part({ > ctype => 'application/pdf', > description => 'Infiniplex.pdf', > disposition => 'attachment', disposition => 'attachment; filename=Infiniplex.pdf', encoding => 'Base64', > msg => "$contract_html_pdf" > }); > $sender->Close(); You should specify the filename inside the disposition header. The mail client aparently uses the description to create a name of the file if you don't and appends .dat to specify it doesn't really know what type of file it is. Second problem is that the default encoding for ->Part() is 7BIT. Which basicaly means "Don't encode the data and hope for best". PDF is a binary format so you should use Base64 encoding to ensure it will get through fine. HTH, Jenda P.S.: One more thing to add to the docs, right ? :-) ===== [EMAIL PROTECTED] === http://Jenda.Krynicky.cz ===== When it comes to wine, women and song, wizards are allowed to get drunk and croon as much as they like. -- Terry Pratchett in Sourcery -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]