cancel
Showing results for 
Search instead for 
Did you mean: 

New to this whole PHPMailer thing... There do I start with this?

I have a bootstrap with a contact_form.php file for a prebuilt contact form, the file reads like this:

 

 

<?php
require 'phpmailer/phpmailer/PHPMailerAutoload.php';

$mail = new PHPMailer;
$mail->SMTPDebug = 4;
// Setting up PHPMailer
// Set mailer to use SMTP
// Visit http://phpmailer.worxware.com/index.php?pg=tip_srvrs for more info on server settings
// For GMail    => smtp.gmail.com
//     Hotmail  => smtp.live.com
//     Yahoo    => smtp.mail.yahoo.com
//     Lycos    => smtp.mail.lycos.com
//     AOL      => smtp.aol.com
$mail->Host = 'smtp.gmail.com';                       // Specify main and backup server
$mail->SMTPAuth = true;                               // Enable SMTP authentication
//This is the email that you need to set so PHPMailer will send the email from 
$mail->Username = 'USERNAME';             // SMTP username
$mail->Password = 'PASSWORD';                           // SMTP password
$mail->SMTPSecure = 'tls';
$mail->Port = 587;                                    // TCP port to connect to
// Add the address to send the mail to
$mail->AddAddress('davidcaindesign@gmail.com');
$mail->WordWrap = 50;                                 // Set word wrap to 50 characters
$mail->IsHTML(true);                                  // Set email format to HTML

// add your company name here
$company_name = 'COMPANY';

// choose which fields you would like to be validated separated by |
// options required - check input has content valid_email - check for valid email
$field_rules = array(
    'name' => 'required',
    'email'   => 'required|valid_email',
    'message' => 'required'
);

// change your error messages here
$error_messages = array(
    'required'    => 'This field is required',
    'valid_email' => 'Please enter a valid email address'

My questions are as follows:

 

I want the emails to go to my regular browser gmail account, what do I need to do to set this up? What user name and password am I putting in? What server / port am I using? no clue where to start with this. Any help is appreciated.