Correct Mime type to send pdf via email

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
Skittlewidth
Forum Contributor
Posts: 389
Joined: Wed Nov 06, 2002 9:18 am
Location: Kent, UK

Correct Mime type to send pdf via email

Post by Skittlewidth »

I'm trying to use Todd_Z's email with attachment class (viewtopic.php?t=34242) to email a pdf to myself immediately after its been created using fPDF.

I wind up with an email and attachment but its corrupted or as Acrobat states, "was sent via email and hasn't been correctly decoded".

I'm guessing I'm not using the correct MIME type, and google has come up with several different ones for .pdf files.

This is the line of code to add the attachment:

Code: Select all

$email ->addAttachment ( "pdf_files/".$filename.".pdf", $filename, "application/x-pdf");
No matter what I've tried, the pdf comes through as 273 bytes instead of 28kb.

Is my mime type wrong or do you think I've got my path to the file incorrect? (I'll go and test that in a sec!)
Post Reply