In de class.phpmailer.php krijg ik een foutmelding die betreft het volgende:
Fatal error: Class 'SMTP' not found in /public/sites/www.tonneurd.com/class.phpmailer.php on line 1158
Als we deze lijn bekijken in het document krijg ik dit:
/**
* Get an instance to use for SMTP operations.
* Override this function to load your own SMTP implementation
* @return SMTP
*/
public function getSMTPInstance()
{
if (!is_object($this->smtp)) {
$this->smtp = new SMTP;
}
return $this->smtp;
}
Heb me eerste fout zelfstandig weten op te lossen.
Uit me 2e fout kom ik echt niet zo makkelijk.
Krijg een foutmelding dat die niet met me SMTP server kan connecten.
Bij deze voeg ik de code toe:
[code]<?php
// $email and $message are the data that is being
// posted to this page from our html contact form
$name = $_REQUEST['name'] ;
$email = $_REQUEST['email'] ;
$comments = $_REQUEST['comments'] ;
// When we unzipped PHPMailer, it unzipped to
// public_html/PHPMailer_5.2.0
require("PHPMailerAutoload.php");
$mail = new PHPMailer();
// set mailer to use SMTP
$mail->IsSMTP();
// As this email.php script lives on the same server as our email server
// we are setting the HOST to localhost
$mail->Host = "smtp.gmail.com"; // specify main and backup server
// Port for e-mail
$mail->Port = 465;
$mail->SMTPAuth = true; // turn on SMTP authentication
// When sending email using PHPMailer, you need to send from a valid email address
// In this case, we setup a test email account with the following credentials:
// email: [email protected]
// pass: password
$mail->Username = "[email protected]"; // SMTP username
$mail->Password = "1----"; // SMTP password
// $email is the user's email address the specified
// on our contact us page. We set this variable at
// the top of this page with:
// $email = $_REQUEST['email'] ;
$mail->From = $email;
// below we want to set the email address we will be sending our email to.
$mail->AddAddress("[email protected]", "Tonny-Boy Verweij");
// set word wrap to 50 characters
$mail->WordWrap = 50;
// set email format to HTML
$mail->IsHTML(true);
$mail->Subject = "You have received feedback from your website!";
// $message is the user's message they typed in
// on our contact us page. We set this variable at
// the top of this page with:
// $message = $_REQUEST['message'] ;
$mail->Body = $comments;
$mail->AltBody = $comments;
if(!$mail->Send())
{
echo "Message could not be sent. <p>";
echo "Mailer Error: " . $mail->ErrorInfo;
exit;
}
2014-02-18 19:22:46 SMTP ERROR: Failed to connect to server: Connection timed out (110) SMTP connect() failed. Message could not be sent.
Mailer Error: SMTP connect() failed.