3
I’m trying to implement email sending with the library Phpmailer, but brought me the following mistakes:
Edit:
I’m testing it locally.
SMTP -> ERROR: Failed to connect to server: Uma tentativa de conexão falhou porque o componente conectado não respondeu corretamente após um período de tempo ou a conexão estabelecida falhou porque o host conectado não respondeu. (10060)
SMTP Error: Could not connect to SMTP host.
Edit 2:
Follows part of var_dump() of the object with error related messages
private 'language' =>
array (size=13)
'provide_address' => string 'You must provide at least one recipient email address.' (length=54)
'mailer_not_supported' => string ' mailer is not supported.' (length=25)
'execute' => string 'Could not execute: ' (length=19)
'instantiate' => string 'Could not instantiate mail function.' (length=36)
'authenticate' => string 'SMTP Error: Could not authenticate.' (length=35)
'from_failed' => string 'The following From address failed: ' (length=35)
'recipients_failed' => string 'SMTP Error: The following recipients failed: ' (length=45)
'data_not_accepted' => string 'SMTP Error: Data not accepted.' (length=30)
'connect_host' => string 'SMTP Error: Could not connect to SMTP host.' (length=43)
'file_access' => string 'Could not access file: ' (length=23)
'file_open' => string 'File Error: Could not open file: ' (length=33)
'encoding' => string 'Unknown encoding: ' (length=18)
'signing' => string 'Signing Error: ' (length=15)
Below follows my shipping code:
$email = new PHPMailer();
$email->IsSMTP();
$email->SMTPSecure = "ssl"; // tbm já tentei tls
$email->Port = 587; // tbm já tentei 465 e tbm sem porta nenhuma
$email->SMTPDebug = 1;
$email->Host = "smtp.gmail.com";
$email->SMTPAuth = true;
$email->Username = "[email protected]";
$email->Password = "minhaSenha";
$email->From = $para;
$email->SetLanguage("en", "../biblioteca/phpmailer/language/");
$email->CharSet = "UTF-8";
$email->FromName = $nome_remetente;
$email->Subject = $assunto;
$email->IsHtml(true);
$email->AddAddress($para);
$email->Body = $msg;
if(!$email->send()){
//return false;
die(var_dump($email->ErrorInfo));
} else {
return true;
}
you are testing this code on a server or on your computer?
– CIRCLE
I’m testing it locally.
– LeoFelipe
Managed to solve @Leofelipe?
– Jorge B.
For min was not working at all until I disabled Avast, Success.
– user30933