Sending Mail Through PHPMailer

1 replies
I'm using PHPMailer with below code to send mail in PHP. But I'm not getting either sending mail or sending failed message, but the white screen. Please help me for the same.

$account="email_address@gmail.com";
$password="accountpassword";
$to="mail@subinsb.com";
$from="vishal@vishal.com";
$from_name="Vishal G.V";
$msg="<strong>This is a bold text.</strong>"; // HTML message
$subject="HTML message";


include("phpmailer/class.phpmailer.php");


$mail = new PHPMailer();
$mail->IsSMTP();
$mail->CharSet = 'UTF-8';
$mail->Host = "smtp.gmail.com";
$mail->SMTPAuth= true;
$mail->Port = 465; // Or 587
$mail->Username= $account;
$mail->Password= $password;
$mail->SMTPSecure = 'ssl';
$mail->From = $from;
$mail->FromName= $from_name;
$mail->isHTML(true);
$mail->Subject = $subject;
$mail->Body = $msg;
$mail->addAddress($to);



if(!$mail->send()){
echo "Mailer Error: " . $mail->ErrorInfo;
}else{
echo "E-Mail has been sent";
}
#mail #phpmailer #sending
Avatar of Unregistered
  • Profile picture of the author AdHustlers
    Have you checked the error logs on your server? I suspect the issue might be your include(). Have you checked to make sure "phpmailer/class.phpmailer.php" is pointing at the correct location *relative* to the file where this code appears?
    {{ DiscussionBoard.errors[11191388].message }}

Trending Topics