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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.