/*
//================================================================================
* phphq.Net Custom PHP Scripts *
//================================================================================
:- Script Name: phMailer
:- Version: 1.5.1
:- Release Date: Jan 27th 2004
:- Last Update: Jan 25 2010
:- Author: Scott Lucht <scott@phphq.net> http://www.phphq.net
:- Copyright(c) 2010 All Rights Reserved
:-
:- This script is free software; you can redistribute it and/or modify
:- it under the terms of the GNU General Public License as published by
:- the Free Software Foundation; either version 2 of the License, or
:- (at your option) any later version.
:-
:- This script is distributed in the hope that it will be useful,
:- but WITHOUT ANY WARRANTY; without even the implied warranty of
:- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
:- GNU General Public License for more details.
:-http://www.gnu.org/licenses/gpl.txt
:-
//================================================================================
* Description
//================================================================================
:- phMailer is a very simple PHP mail script that supports attachments. This is very helpful if you want your
:- visitors to be able to contact you without them knowing your real email address. On great feature of this
:- script is the ability to allow users to attach multiple files when sending an email directly from your site. Of
:- course, you can disable this feature if you wish. Any file type is accepted as long as they are included in your
:- file extension list. Another popular use for a PHP email form is protection against spam bots. Spam, is a major
:- downside of email, and placing your email publicly on your website is asking for spam. Spam bots can take your
:- email address right off your site and add it to thousands of spam databases, resulting in a never ending supply
:- of spam for you. I coded this script, because I couldn't find a simple mail script that would allow my visitors to 
:- send me attachments while keeping my email hidden from spam bots.
//================================================================================
* Setup
//================================================================================
:- To setup this script, simply upload this file to your website. Then edit the variables found herein to adjust
:- how the form works.
//================================================================================
* Change log
//================================================================================
:- Version 1.0
:-		1) Initial Release
:- Version 1.1
:-		1) Minor bug fixes / html improvement	
:- Version 1.2
:-		1) Added CSS styling
:-		2) Cleaned html and improved form style
:-		3) Removed html embedded directly in php tags
:-		4) Improved security checks to prevent forging email headers
:- Version 1.3
:-		1) Cleaned up html and CSS styles
:-		2) Added support to attach multiple files
:-		3) Minor bug fixes
:- Version 1.4
:-		1) Re-write of many core functions to improve attachment handling
:-		2) Added feature that allows users to select an email address from a drop down
:-		3) Minor bug fixes
:- Version 1.5
:-		1) Added multiple new security checks to prevent email header forging. 
:-		2) Cleaned up script and reduced PHP needed to complete tasks.
:-		3) Minor bug fixes
:- Version 1.5.1
:-		1) Cleaned up script and reduced PHP needed to complete tasks.
:-		2) Added text/html as email type to allow users to use line breaks when sending a message. Messages
:-			now display correctly in newer email clients such as Gmail.
:-		3) Removed unnecessary email headers and improved standardization
:-		4) Made sure script is completely compatible with PHP 5.3.x
//================================================================================
* Frequently Asked Questions
//================================================================================
:- Q1: I never receive any mail, but people say they have emailed me through the form.
:-		1) Try the mailtest.php file that came with this script. If that fails, then mail() is probably not setup right.
:-		2) Double check to make sure your email address is correct.
:-		3) Try using the form with $allowattach set to 0. It could be your mail server rejecting the mail
:-				because of attachments.
:-		4) If you are on windows, make sure your SMTP is set to your mail server. If you are on Linux, make sure
:-				your sendmail path if correct. Again, ask your host if you are unsure about this.

:- Q2: I never receive any attachments.
:-		1) Maybe your server has some security against uploading files or sending attachments through mail,
:-				check with your host on this issue. This script does send attachments, it's been tested many
:-				times on many different platforms and versions of PHP with safe mode on and off.
:-		2) Maybe the files people are submitting are too big. Check php.ini for the post_max_size,
:-				upload_max_filesize, file_uploads, max_execution_time you may have to check with your host on this.
:-
:- Q3: The page takes long to load and then gives me a page cannot be displayed or a blank page.
:-		1) This is usually due to a low value in php.ini for "max_execution_time". 
:-		2) A newer ini setting "max_file_uploads" in php 5.2.12 was added which may be limiting the number
			of simultaneous uploads.
:-		3) Your "upload_max_filesize" and "post_max_size" in php.ini might be set to low.
:-
:- Q4: How do I edit the colors of the form?
:-		1) You will need to edit the CSS near the bottom of the script to change the looks and colors of the form.
:-			Check http://www.w3schools.com/css/default.asp for more information on CSS.
:-
:- Q5: Can I add more fields for the users to enter information in?
:-		1) That's the beauty of PHP! It's open source, you can edit it all you want, change whatever you don't like.
:-				Just please leave in my copyright. So many times I see my script without it and it makes me sad. 
:-
:- Q6: Dude! Can you add more fields for me? I don't know PHP!
:-		1) Maybe, but I do usually charge a fee depending on what you want done. Don't freak out! It's usually
:-				a very small one. I can't do everything for free..
:-
:- Q7: Can I remove your copyright link?
:-		1) I can't physically stop you. However, I really appreciate it when people leave it intact.
:-			Some people donate $5, $10, $20 to take it off.
:-
:- Q8: You never respond to my emails or to my questions in your forums!
:-		1) I'm a very busy guy. I'm out of town a lot, and at any given time I have several projects going on.
:-			I get a lot of emails about this script, not to mention my other ones.
:-		2) I only understand English. If your English is very bad please write in your native language and then
:-			translate it to English using <http://babelfish.altavista.com/babelfish/tr>.
:-		3) If you are going to contact me, describe the issue you are having as completely as possible.
:-			"dude me form don't work see it at blah.com what's wrong??!?!" will get no response, ever. Write
:-			in detail what the problem is. Spend a minute on it, and maybe I'll take some of my time to reply.
/*