Page 1 of 1

Mail Attachements

Posted: Sun Nov 07, 2010 10:46 am
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