Emailing a pdf document...

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
bender
Forum Newbie
Posts: 11
Joined: Sun Jan 12, 2003 6:53 am
Location: Sydney Australia

Emailing a pdf document...

Post by bender »

Hi all,

I've successfully coded a script that takes in details specified by the user, populates a pdf document from the form contents and emails a copy of the document back to the user.

The application is for creating online trust deeds, the idea being that using pdf makes it difficult for users to extract the content of the deeds via copy paste.

My problem is that when the email arrives, the pdf document is attached, but it's contents are appended to the message body (which allows users to simply copy/paste, without actually paying for another trust deed.

The mail() code goes...

Code: Select all

$strPDFHeader = 
"

--THEBOUNDARY-69241
Content-Type: application/octet-stream; name="deed.pdf";
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="deed.pdf"

";

$strFooter = 
"
--THEBOUNDARY-69241--
";
	

	$newlineto .= $strPDFHeader.$encoded.$strFooter;
	
$mailit2 = @mail($email, $F_SUBJECT, $newlineto, $strHeader);
...where $encoded contains the contents of the pdf document. The script works 100%, aside from letting users copy/paste the content of the pdf document directly from the message body. Anyone got any ideas on how I can the contents being displayed?

Regards,

Ben
Post Reply