I'm trying to implement sending mail with the PHPMailer library , however I've brought you the following errors :
Edit:
I am testing 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:
This is part of var_dump () a> 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 is 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;
}