Two major methods are:
Very basic:
http://www.w3schools.com/php/func_mail_mail.asp[
^]
With multiple interfaces, based on the PEAR repositiory:
http://pear.php.net/package/Mail[
^],
http://pear.php.net/manual/en/package.mail.mail.php[
^],
http://en.wikipedia.org/wiki/PEAR[
^],
http://pear.php.net/[
^].
For adding "attachments", especially if you have to work on the lower level, it's important to understand that nothing is really "attached", everything is embedded in one text block of a
multipart mail content, which is subdivided into "parts" each having its separate MIME content type; parts not suitable for text presentations are usually encoded in base64:
http://en.wikipedia.org/wiki/E-mail_attachment[
^],
http://en.wikipedia.org/wiki/Base64[
^].
This is how base64 can be used in PHP:
http://php.net/manual/en/function.base64-encode.php[
^].
Now, a
big warning for you: sending mails out from the user data on a Web page is one of the most "popular" security holes. If such input is not properly sanitized, it is easy to turn your Web server's host into a zombie sending spam or something like that. Please see my past answer:
unable to send mail , it showing the error in below code .[
^].
—SA