PHP Mail Function

What type of headers have to be added in the mail function to attach a file?

A lot. And unless you want to properly learn them, I’d strongly suggest using a third party script like PHPMailer.

I wouldnt use PHP’s built-in mail function since its kinda primitive and wont really handle complex email requests. Look for email libraries from PEAR may be your best shot to find a solution to your problem.

I used PHPMailer, and I think it is very easy and most reliable to use.

You just try and check.