Mail Attachements

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
Addos
Forum Contributor
Posts: 305
Joined: Mon Jan 17, 2005 4:13 pm

Mail Attachements

Post by Addos »

I have a small script I’m playing with that sends out mail in small timed amounts in a queue and works quite well. I’m not too sure how I should handle the attachments that are sometimes sent with mail. For example if somebody adds a Word Doc or PDF how is the mail script supposed to recognise what the file is.

Right now I have

Code: Select all

$content_type = "Application/pdf";
Which strangely works for both of the above files but is there some general code that recognises all (or limited) file types or should I be running some ‘if’ statement at attaching stage saying if(file is either PDF, Word etc ) let it through if not show error when adding attachment? Seems a convoluted way though so how would this normally be handled?
Any pointers would be great
Thanks
Post Reply