Send Mail from Gmail with PHP

Credits: Tech Meal and PHPMailer

Purpose: This script will send email from a Gmail account to any valid email address. You must have a Gmail account to use it.
These scripts are tailored to be an out-of-the-box solution for a PHP contact form for use on a website.

1. Copy and save the following code as phpmailer.php in a folder of your choice on your webserver.
(Note: This is PHPMailer version 1.73 with slight modifications to work with GMail.)

[Download] (right click -> Save Target As)

2. Copy and save the following code as smtp.php. Place it in the same folder as phpmailer.php.

[Download] (right-click -> Save Target As)

3. Copy and save the following code as sendmail.php. Place it in the same folder as phpmailer.php.

[Download] (right-click -> Save Target As)

4. Let's create the form by which a user will send information.
Copy and save the following code as form.php. Place it in the same folder as phpmailer.php.

[Download] (right-click -> Save Target As)

5. Lastly, you must edit your php.ini to enable the OpenSSL extension. Find the line that contains extension=php_openssl.dll. Remove the semicolon to enable OpenSSL.

That's it! Now just let your users send their mail with this form, and you'll be *nearly* guaranteed to receive it.

Note: You use this script at your own risk!

Bugs, comments, questions? Contact Me