Jump to content

PHPMailer not showing error but not sending mail


OlammieConcept

Recommended Posts

I am trying to send mail using the PHPMailer classes with smtp, i was not getting any error but the mail isn't going. Please find below the code I used.

 

<?php

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

include "class.smtp.php";

include "class.phpmailer.php";

 

$Host = $_POST["smtpUrl"]; // SMTP servers

$Username = $_POST["smtpUsername"]; // SMTP password

$Password = $_POST["smtpPassword"];

 

$From = $_POST["fromEmail"];

$FromName = $_POST["from"];

$to = $_POST["to"];

$subject = $_POST["subject"];

$body = $_POST["boduu"];

$bcclist = $_POST["bcc"];

 

 

$mail = new PHPMailer();

$mail->IsSMTP();

$mail->Mailer = "smtp"; // send via SMTP

$mail->Host = $Host;

$mail->SMTPAuth = true; // turn on SMTP authentication

$mail->Username = $Username;

$mail->Password = $Password;

 

$mail->From = $From;

$mail->FromName = $FromName;

 

 

//Logic for the BCC mail will go here

 

$mail->WordWrap = 50; // set word wrap

$mail->Priority = 1;

$mail->IsHTML(true);

$mail->Subject = $subject;

$mail->Body = $body;

$mailer->AddAddress($to);

 

foreach($bcclist as $bccer)

{

$mail->AddBCC($bccer);

}

 

if(!$mail->Send())

{

echo "Mailer Error: " . $mail->ErrorInfo;

}

else

{

echo "The mail has been sent in HTML format. This is inbox confirmed.";

}

 

?>

 

 

I will appreciate any help provided by you in the house.

 

Thank You in advance.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.