Thursday, 14 April 2016

How to Send Simple e-Mail using PHPMailer with Gmail SMTP on our Localhost Server

How to Send Simple e-Mail using PHPMailer with Gmail SMTP on our Localhost Server

require_once('class.phpmailer.php');
    $mail = new PHPMailer();
    $mail->CharSet =  "utf-8";
    $mail->IsSMTP();
    $mail->SMTPAuth = true;
    $mail->Username = "your_gmail@gmail.com";
    $mail->Password = "your_gmail_password";
    $mail->SMTPSecure = "ssl";  
    $mail->Host = "smtp.gmail.com";
    $mail->Port = "465";
    $mail->setFrom('your_gmail@gmail.com', 'your name');
    $mail->AddAddress('to_mail@mail.com', 'receivers name');
    $mail->Subject  =  'using PHPMailer';
    $mail->IsHTML(true);
    $mail->Body    = 'Hi there ,
                        <br />
                        this mail was sent using PHPMailer...
                        <br />
                        cheers... :)';
  
     if($mail->Send())
     {
        echo "Message was Successfully Send :)";
     }
     else
     {
        echo "Mail Error - >".$mail->ErrorInfo;
     }
  
?>

Let's Send HTML Format eMails in PHP using PHPMailer and Gmail SMTP

Let's Send HTML Format eMails in PHP using PHPMailer and Gmail SMTP

button-download_zip


We have already write a previous artical  on Send email using Gmail SMTP with PHPMailer but that was simple mail sending script, in that script mail sends in plain text format.


now we can discuses in  article  How to Send HTML eMails in PHP with PHPMailer.


Index.Php / Complete Code of Send HTML eMails in PHP with PHPMailer.

Here is our last page contains all important code to send letters in
HTML position, design your gmail qualifications inside of attempt pieces
username, and secret key item, you can likewise utilize your space
SMTPas well.