Ciao a tutti, ho un problema con l' invio di una email con la classe PHPmailer.
In locale mi da questo errore:
2016-10-23 08:54:45 Extension missing: openssl Mailer Error: Extension missing: openssl
e mi hanno detto che mi manca openSSL. Su server invece che mi hanno assicurato che c' è istallato openSSL, quando eseguo lo script non mi fa nessun print e l' apache non mi logga nessun errore e la mail non arriva a destinazione. Posto il codice grazie.
Codice PHP:
$mail = new PHPMailer();
$body = 'Test Mail';
$mail->IsSMTP(); // telling the class to use SMTP
$mail->SMTPDebug = 2; // enables SMTP debug information (for testing) // 1 = errors and messages// 2 = messages only
$mail->SMTPAuth = true; // enable SMTP authentication
$mail->SMTPSecure = "tls"; // sets the prefix to the servier
$mail->Host = "smtp.blackskip.com"; // sets GMAIL as the SMTP server
$mail->Port = 587; // set the SMTP port for the GMAIL server
$mail->Username = "admin@blackskip.com"; // GMAIL username
$mail->Password = "*****"; // GMAIL password
$mail->SetFrom('noreplay@blackskip.com', 'First Last');
//$mail->AddReplyTo("name@yourdomain.com","First Last");
$mail->Subject = "PHPMailer Test Subject via smtp (Gmail), basic";
$mail->AltBody = "To view the message, please use an HTML compatible email viewer!"; // optional, comment out and test
$mail->MsgHTML($body);
$address = "cldgcm@gmail.com";
$mail->AddAddress($address, "John Doe");
//$mail->AddAttachment("images/phpmailer.gif"); // attachment
//$mail->AddAttachment("images/phpmailer_mini.gif"); // attachment
if(!$mail->Send())
{
echo "Mailer Error: " . $mail->ErrorInfo;
}
else
{
echo "Message sent!";
}