PHPMailer not showing error but not sending mail. See Code

the mail() function

Moderators: macek, egami, gesf

OlammieConcept
New php-forum User
New php-forum User
Posts: 1
Joined: Mon Feb 04, 2013 12:59 am

PHPMailer not showing error but not sending mail. See Code

Postby OlammieConcept » Mon Feb 04, 2013 1:11 am

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.

Return to “PHP coding => Mail”

Who is online

Users browsing this forum: Exabot [Bot] and 2 guests