Jump to content

PHPMailer problem


teitoklein01

Recommended Posts

I downloaded the PHPMailer. I can send email from gmail mail server to the registered users in my website smoothly. But when I upload it to my web host basically I edited all the credentials and apply my new host mail server username, password, host, port, etc. When i try to send this is the error:

 

SMTP Error: Authentication Failed

 

and this is my code

 

<?php session_start(); ?>
<html>
<head>
<title>PHPMailer - SMTP (Gmail) basic test</title>
</head>
<body>
<form action="GET">
<?php

$pEmail = $_SESSION['uEmail'];
$pUser = $_SESSION['user'];
$eTitle = $_SESSION['uTitle'];
$eDesc = $_SESSION['uDesc'];
$ePrice = $_SESSION['uPrice'];
//error_reporting(E_ALL);
error_reporting(E_STRICT);

//date_default_timezone_set('America/Toronto');

require_once('class.phpmailer.php');
//include("class.smtp.php"); // optional, gets called from within class.phpmailer.php if not already loaded

$mail             = new PHPMailer();

//$body             = file_get_contents('contents.php');
//$body             = eregi_replace("[\]",'',$body);
$body = "Welcome to GankGames, ".$pUser.
	"<br><br>
	Your Game has been uploaded successfully!<br><br>
	Below is the summary of your upload transaction: <br><br>
	Game Name: ".$eTitle."<br>
	Game Description: ".$eDesc."<br>
	Game Price: ".$ePrice."<br><br>
	Your game will be verified in 24 hours for security purposes. After verifying we will going to send you again an email informing you that 			        your game is already active <br><br><br>
	Thank you very much!!";

$mail->IsSMTP(); // telling the class to use SMTP
$mail->SMTPDebug  = 2;                     // enables SMTP debug information (for testing)
                                           // 1 = errors and messages
                                           // 2 = messages only
$mail->SMTPAuth   = true;                  // enable SMTP authentication
$mail->SMTPSecure = "ssl";                 // sets the prefix to the servier
$mail->Host       = "mail.********.com";      // sets GMAIL as the SMTP server
$mail->Port       = 465;                   // set the SMTP port for the GMAIL server
$mail->Username   = "[email protected]";  // GMAIL username
$mail->Password   = "*********";            // GMAIL password

$mail->SetFrom('mail.********.com', '[email protected]');

//$mail->AddReplyTo("[email protected]","jm");

$mail->Subject    = "Game Verification";

//$mail->AltBody    = "To view the message, please use an HTML compatible email viewer!"; // optional, comment out and test

$mail->MsgHTML($body);

$address = $pEmail;
$mail->AddAddress($address, $pUser);

//$mail->AddAttachment("images/phpmailer.gif");      // attachment
//$mail->AddAttachment("images/phpmailer_mini.gif"); // attachment

if(!$mail->Send()) {
  echo "Mailer Error: " . $mail->ErrorInfo;
} else {
  //echo "Message sent!";
  //$_SESSION['uploaded'] = "Uploaded Successfully";
  $upload = "Uploaded Successfully";
  ob_start();
  header("Location: confirm.php?pupload=$upload");
  ob_end_flush();
}

?>
</form>

</body>
</html>

 

help

Link to comment
https://forums.phpfreaks.com/topic/230482-phpmailer-problem/
Share on other sites

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.