Code:
function emailsend($to,$from,$subject,$mensahe)
{
try
{
$mail = new PHPMailer(true); //New instance, with exceptions enabled
//$body = file_get_contents('contents.html');
$body = preg_replace('/\\\\/','', $mensahe); //Strip backslashes
$mail->IsSMTP(); // tell the class to use SMTP
$mail->SMTPAuth = true; // enable SMTP authentication
$mail->Port = 25; // set the SMTP server port
$mail->Host = "ssl://smtp.gmail.com"; // SMTP server
$mail->Username = "mymail@gmail.com"; // SMTP server username
$mail->Password = "mypassword"; // SMTP server password
$mail->IsSendmail(); // tell the class to use Sendmail
$mail->AddReplyTo("mymail@gmail.com","First Last");
$mail->From = "no_reply@ravenresort.co.nr";
$mail->FromName = "Admin Raven Resort";
$tos = "$to";
$mail->AddAddress($tos);
$mail->Subject = "$subject";
$mail->AltBody = "To view the message, please use an HTML compatible email viewer!"; // optional, comment out and test
$mail->WordWrap = 80; // set word wrap
$mail->MsgHTML($body);
$mail->IsHTML(true); // send as HTML
$mail->Send();
//echo 'Message has been sent.';
}
catch (phpmailerException $e)
{
echo $e->errorMessage();
}
}
This is my code. =[
In my other host, it works. But then when I transferred here at x10, it returned the error.
Im using Google's SMTP. I'm not sure if it's google app, but it's in my Gmail's settings. in the POP tab.