Salve,
devo inviare email mediante codice php con autenticazione SMTP.
girando sul web ho letto che č necessario utilizzare PhpMailer cosč ho scaricato il file class.phpmailer.php e nel mio file php ho scritto il seguente codice:
Purtroppo nell'error log del php ricevo i seguenti errori:codice:require("lib/class.phpmailer.php"); $nome_mittente = 'Mario Rossi'; $email_mittente = 'm.rossi@libero.it'; $corpo_email .= '<strong>ciao</strong'; /* INVIO EMAIL */ $email_destinatario = 'giuseppe.verdi@libero.it'; $msg = new PHPMailer; $msg->IsSMTP(); // Utilizzo della classe SMTP al posto del comando php mail() $msg->SMTPAuth = true; // Autenticazione SMTP $msg->SMTPKeepAlive = "true"; $msg->Host = "smtp.libero.it"; $msg->Port = 25; $msg->Username = "m.rossi@libero.it"; // Nome utente SMTP autenticato $msg->Password = "123456"; // Password account email con SMTP autenticato $msg->IsHTML(true); $msg->From = $email_mittente; $msg->FromName = $nome_mittente; $msg->AddAddress($email_destinatario); $msg->Subject = "oggetto della email"; $msg->Body = $corpo_email; /* CONTROLLO SE L'EMAIL VIENE SPEDITA CORRETTAMENTE */ if($msg->Send()) { echo "Il messaggio di posta č stato inviato correttamente"; } else { echo "errore nella spedizione: ".$msg->ErrorInfo; }
Cosa sbaglio?codice:[07-Jul-2016 10:28:38 Europe/Rome] PHP Warning: include_once(class.smtp.php): failed to open stream: No such file or directory in /public_html/lib/class.phpmailer.php on line 515 [07-Jul-2016 10:28:38 Europe/Rome] PHP Warning: include_once(): Failed opening 'class.smtp.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /public_html/lib/class.phpmailer.php on line 515 [07-Jul-2016 10:28:38 Europe/Rome] PHP Fatal error: Class 'SMTP' not found in /public_html/lib/class.phpmailer.php on line 583
grazie.

Rispondi quotando
