1
I have the following code:
<?php
require'PHPMailerAutoload.php';
$mail = new PHPMailer();
$mail->IsSMTP();
$mail->Port = '465';
$mail->Host = 'smtp.gmail.com';
$mail->IsHTML(true);
$mail->Mailer = 'smtp';
$mail->SMTPSecure = 'ssl';
$mail->SMTPAuth = true;
$mail->Username = '[email protected]';
$mail->Password = 'senhadoemail';
$mail->SingleTo = true;
$mail->From = "[email protected]";
$mail->FromName = "nomedousuario";
$mail->addAddress("[email protected]");
$mail->Subject = "assunto do email";
$mail->Body = "conteudo do email";
if(!$mail->Send()){
echo "Erro ao enviar Email:" . $mail->ErrorInfo;
}else{
echo "Mensagem enviada com sucesso!"
}
?>
This code works normally by sending emails from a sender who has a Gmail account to any other account, the problem is that when switching to Live/Hotmail it does not work. The changes I tried to make were as follows:
$mail->Host = 'smtp.live.com';
$mail->SMTPSecure = 'tsl';
I also changed the sender’s email to the end @Hotmail.com.
The mistake I get is: SMTP connection failed()
.
I run this code on localhost and wonder what I’m doing wrong.
in fact this question is about e-mail using live/Hotmail, even because using gmail the code is in full operation
– Roberto
Roberto, I adjusted the title to reflect what I understood to be your problem. Try to make headlines that quickly describe the problem; "Help with X" doesn’t explain anything to anyone who sees your question on the main page.
– brasofilo
Oh yes, I thought the problem was the same. I already deleted the comment.
– user28595