Hi I try to send mail to registred user.
This is my code :
function email($to, $subject, $body, $from){
require'PHPMailer-master/PHPMailerAutoload.php';
define('GUSER', '[email protected]');
define('GPWD', 'pass');
$mail = new PHPMailer(); // create a new object
$mail->IsSMTP(); // enable SMTP
$mail->SMTPDebug = 0; // debugging: 1 = errors and messages, 2 = messages only
$mail->SMTPAuth = true; // authentication enabled
$mail->SMTPSecure = 'ssl'; // secure transfer enabled REQUIRED for GMail
$mail->Host = 'smtp.gmail.com';
$mail->Port = 465;
$mail->Username = GUSER;
$mail->Password = GPWD;
$mail->SetFrom($from);
$mail->Subject = $subject;
$mail->Body = $body;
$mail->AddAddress($to);
}
function register_user($register_data){
array_walk($register_data, 'array_sanitize');
$register_data['password'] = md5($register_data['password']);
$fields = '`' . implode ('`, `', array_keys($register_data)) . '`';
$data = '\'' . implode('\',\'',$register_data) . '\'';
mysql_query("INSERT INTO `users` ($fields) VALUES ($data)");
email($register_data['email'], 'Aktivirajte svoj korisnički račun', "Zdravo".$register_data['username'].",\n\n da bi aktivirao svoj korisnički račun odi na dolje navedeni link:\n\n http://localhost/New%20folder%20(4)/index.php/activate.php?email=".$register_data['email']."&email_code=".$register_data['email_code']."\n\n CroVision");
}
There is no errors in my code but still can't send mail.
Thanks
$mail->Send()
call?