How to send email by using phpmailer


Posted on 13 Feb 15 by Vickey

First Download and extract it now include it in your file


now create a function

 function sendEmail($receiptEmail,$senderEmail,$cc,$subject,$message)
     //function sendEmail($receiptName, $receiptEmail, $subject, $message, $senderEmail='', $senderName='test')
    $subject = utf8_decode($subject);
      $mail = new PHPMailer();
      $mail->SMTPAuth   = true; 
      $mail->SMTPSecure = "ssl";  
      $mail->Host       = ""; 
      $mail->Port       = 465;                
      $mail->Username   = "";
      $mail->Password   = "example@12345";            
      $mail->SetFrom("$senderEmail", "$senderName"); 
      $mail->Subject    = $subject; 
      $mail->Body       = $message;
      $mail->AddAddress($receiptEmail, $receiptName);
      return $mail->Send();

and now you call it where you want to send email

If this post help you reduce time to develop, you can help me to maintain this website :)