6
I am trying to send an email using my Cpanel account and the phpmailler class but I am not succeeding , the code I am using is the same as the Phpmailler documentation, how should I proceed? , would anyone have a fucnional code to share? , thank you.
require_once(Yii::app()->basePath . '/components/PHPMailer-master/PHPMailerAutoload.php');
$mail = new PHPMailer(true); // create a new object
$mail->IsSMTP(); // enable SMTP
$mail->SMTPDebug = 4; // debugging: 1 = errors and messages, 2 = messages only
$mail->SMTPAuth = true; // authentication enabled
$mail->SMTPSecure = 'tls'; // secure transfer enabled REQUIRED for GMail
$mail->Host = "vps.meudominio.com.br";
$mail->Port = 25;
$mail->IsHTML(true);
$mail->Username = "[email protected]";
$mail->Password = "testeste";
$mail->SetFrom("[email protected]");
$mail->Subject = "Testesteaste";
$mail->Body = "<body> <img width='1px' height='1px' src='http://www.testesteste.com.br' /> <h3>hu3hu3h3u3hu</h3> TEEEESTE!!!!</body>";
$mail->AddAddress("[email protected]");
if(!$mail->Send())
{
echo "Mailer Error: " . $mail->ErrorInfo;
}else{
}
exit;
First welcome to Stackoverflow in English, check out the Tour to take better advantage of the features it offers: http://answall.com/tour. Second, we need you to edit your question with the code you already have available and not working.
– Giancarlo Abel Giulian
Are you returning any errors? I use the php file
class.phpmailer.php
and notPHPMailAutoload.php
as in your case.– Giancarlo Abel Giulian
Apparently the door is wrong, 25 is for smtp without authentication for
tls
should be another. Try switching to 465– rray
Try with port 587 using the same code posted.
– Marcos Regis