How to Send e-Mail using PHPMailer and Gmail SMTP

First of all download the PHPMailer library from this link :



    $mail = new PHPMailer();
    $mail->CharSet =  "utf-8";
    $mail->SMTPAuth = true;
    $mail->Username = "";
    $mail->Password = "your_mail_password";
    $mail->SMTPSecure = "ssl";  
    $mail->Host = "";
    $mail->Port = "465";
    $mail->setFrom('', 'your name');
    $mail->AddAddress('', 'receivers name');
    $mail->Subject  =  'using PHPMailer';
    $mail->Body    = 'Hi there ,
                        <br />
                        this mail was sent using PHPMailer...
                        <br />
                        cheers... :)';
  echo "Message was Successfully Send :)";
  echo "Mail Error - >".$mail->ErrorInfo;

if you have using other mail server like yahoo, bing, or your own domain mail id's replace the $mail->Username and $mail->Password with particular mail server information

Related Post

Latest Post

Recent Posts Widget

Make sure to never miss a thing...

Get the latest news from the creative industry along with other creative goodies, conveniently delivered to social media.