I have a code to send activation link to user email and click it for account activation. I am using PHPMailer for sending mail and configure SMTP authentication but email not sent yet and shown:
Mailer Error: Language string failed to load: data_not_accepted
I have put phpmailer.lang-en.php under htdocs folder already,so what mighht cause this error?Thanks....
The following is my form processing code:
sendmail portion in php.iniPHP Code:<?php
ini_set("include_path", "path/to/language/file");
//Connect to mysql database
$conn = mysql_connect("localhost", "root", "") or die('Could not connect: ');
$db = mysql_select_db("movie_ticket_booking", $conn) or die('Could not select database');
//global variable
$table1 = "temp_members";
$table2 = "registered_member";
//Random confirmation code
$confirm_code = md5(uniqid(rand()));
//This code runs if the form has been submitted
if (isset($_POST['submit']))
{
// checks if the email address is alredy registered
//if (!get_magic_quotes_gpc())
//{
//$_POST['email'] = addslashes($_POST['email']);
//}
$emailcheck = $_POST['email'];
$check = mysql_query("SELECT email FROM $table2 WHERE email = '$emailcheck'") or
die(mysql_error());
$check2 = mysql_num_rows($check);
//if the name exists it gives an error
if ($check2 != 0)
{
die('Sorry, the email address' . $_POST['email'] . ' is already registered.');
}
// encrypt the password
$pass1 = md5($pass1);
//if (!get_magic_quotes_gpc())
//{
//pass1 = addslashes($pass1);
//$_POST['member_id'] = addslashes($_POST['member_id']);
//Insert record to database
$insert = mysql_query("INSERT INTO $table1(confirm_code,name,email,password,tel,address)
VALUES ('$confirm_code','" . $_POST['name'] . "','" . $_POST['email'] .
"', '" . $_POST['pass1'] . "','" . $_POST['tel'] . "','" . $_POST['address'] ."')")
or die(mysql_error());
// }
//if successfully inserted,send confirmation link to email
if ($insert)
{
echo "thank for your registration!";
require ("class.phpmailer.php");
$mail = new PHPMailer();
$mail->IsSMTP();
$mail->Host = "localhost";
$mail->SMTPAuth = true;// turn on SMTP authentication
$mail->Username = "root";// SMTP username
$mail->Password = "";// SMTP password
$mail->SetLanguage("en","phpmailer/language");
//compose mail
$mail->From = "admin@localhost.com";
$mail->FromName = "Cinema Admin";
$mail->AddAddress($_POST['email']);
$mail->AddReplyTo("admin@localhost.com", "Cinema Admin");
$mail->Subject = 'Your confirmation link here';
$mail->Body = "Your confirmation link\r\n";
$mail->Body .= "Click on this link to activate your sccount\r\n";
$mail->Body .= "http://localhost/www/confirm.php?passkey=$confirm_code";
//send mail
if (!$mail->Send())
{
echo "Message was not sent <p>";
echo "Mailer Error: " . $mail->ErrorInfo;
exit;
}
echo "Message has been sent";
}
//if not found
else
{
echo "Not found your email in our database";
}
//if your email successfully sent
//if ($sentmail)
//{
//echo "Your confirmation link has been sent to your email address.";
//}
//else
//{
// echo "Cannot send confirmation link to your email address.";
//}
}
?>
PHP Code:[mail function]
; For Win32 only.
SMTP = localhost
smtp_port = 25
; For Win32 only.
sendmail_from = admin@localhost.com



Reply With Quote



Bookmarks