PHPMailer fout SMTP
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:
Code (php)
1
2
3
4
5
6
7
8
9
10
11
12
2
3
4
5
6
7
8
9
10
11
12
/**
* 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;
}
* 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;
}
Kan iemand mij verder helpen met dit probleem?
Groetjes,
Tonny
Include ook eens: class.smtp.php
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)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
<?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;
}
echo "Message has been sent";
?>
[/code}
Kan iemand hiermee verder helpen?
[modedit="Bas IJzelendoorn"]e-mailadressen verwijderd ivm kan op spam.[/modedit]
// $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;
}
echo "Message has been sent";
?>
[/code}
Kan iemand hiermee verder helpen?
[modedit="Bas IJzelendoorn"]e-mailadressen verwijderd ivm kan op spam.[/modedit]
Gewijzigd op 18/02/2014 19:06:12 door Bas IJzelendoorn
http://phpmailer.worxware.com/?pg=examplebgmail
Gebruikt de gebruikelijke poort 587 ipv 465.
Probeer die eens
Gebruikt de gebruikelijke poort 587 ipv 465.
Probeer die eens
Ivo P op 18/02/2014 14:37:45:
http://phpmailer.worxware.com/?pg=examplebgmail
Gebruikt de gebruikelijke poort 587 ipv 465.
Probeer die eens
Gebruikt de gebruikelijke poort 587 ipv 465.
Probeer die eens
Werkt helaas ook niet, blijf de foutmelding houden.
Edit: Heb nu een nieuwe foutmelding
Code (php)
1
2014-02-18 15:26:50 SMTP ERROR: Failed to connect to server: Connection timed out (110) SMTP connect() failed. Message could not be sent.
Gewijzigd op 18/02/2014 16:27:35 door TonnyBoy Verweij
Ger van Steenderen op 18/02/2014 18:14:12:
Code (php)
1
2
2
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.
Mailer Error: SMTP connect() failed.
Blijf dezelfde foutmelding houden helaas.
Wat krijg je dan?
Gewijzigd op 18/02/2014 20:39:18 door Ger van Steenderen
Ger van Steenderen op 18/02/2014 20:36:47:
Ik krijg precies dezelfde foutmelding...
Waar draai je dit script?
Aad B op 18/02/2014 20:50:14:
Connection timed out, misschien de poort niet open vanaf de bron (waar de php draait) naar smtp.gmail.com??
Waar draai je dit script?
Waar draai je dit script?
Goedeavond Aad, het script draait bij mijndomein.nl hosting.
Ivo P op 18/02/2014 14:37:45:
http://phpmailer.worxware.com/?pg=examplebgmail
Gebruikt de gebruikelijke poort 587 ipv 465.
Probeer die eens
Gebruikt de gebruikelijke poort 587 ipv 465.
Probeer die eens
Beide poorten zijn "gebruikelijk", $mail->SMTPSecure = "tls"; hoort bij poort 587 en $mail->SMTPSecure = "ssl"; behoort bij poort 465
Aad B op 18/02/2014 20:52:32:
Beide poorten zijn "gebruikelijk", $mail->SMTPSecure = "tls"; hoort bij poort 587 en $mail->SMTPSecure = "ssl"; behoort bij poort 465
Ivo P op 18/02/2014 14:37:45:
http://phpmailer.worxware.com/?pg=examplebgmail
Gebruikt de gebruikelijke poort 587 ipv 465.
Probeer die eens
Gebruikt de gebruikelijke poort 587 ipv 465.
Probeer die eens
Beide poorten zijn "gebruikelijk", $mail->SMTPSecure = "tls"; hoort bij poort 587 en $mail->SMTPSecure = "ssl"; behoort bij poort 465
Voor zowel de ssl en de tls werkt het niet. Blijf dezelfde foutmelding houden.
TonnyBoy Verweij op 18/02/2014 20:51:11:
Goedeavond Aad, het script draait bij mijndomein.nl hosting.
Aad B op 18/02/2014 20:50:14:
Connection timed out, misschien de poort niet open vanaf de bron (waar de php draait) naar smtp.gmail.com??
Waar draai je dit script?
Waar draai je dit script?
Goedeavond Aad, het script draait bij mijndomein.nl hosting.
Ik mis wel de $mail->SMTPSecure declaratie in je script.
Zie het eerder genoemde voorbeeld: http://phpmailer.worxware.com/?pg=examplebgmail
Code (php)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
<?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();
$mail->IsSMTP(); // telling the class to use SMTP
$mail->Host = "smtp.gmail.com"; // SMTP server
$mail->SMTPDebug = 1; // enables SMTP debug information (for testing)
// 1 = errors and messages
// 2 = messages only
$mail->SMTPAuth = true; // enable SMTP authentication
$mail->SMTPSecure = "ssl"; // sets the prefix to the servier
$mail->Host = "smtp.gmail.com"; // sets GMAIL as the SMTP server
$mail->Port = 465; // set the SMTP port for the GMAIL server
$mail->Username = "[email protected]"; // GMAIL username
$mail->Password = "------"; // GMAIL 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;
}
echo "Message has been sent";
?>
// $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();
$mail->IsSMTP(); // telling the class to use SMTP
$mail->Host = "smtp.gmail.com"; // SMTP server
$mail->SMTPDebug = 1; // enables SMTP debug information (for testing)
// 1 = errors and messages
// 2 = messages only
$mail->SMTPAuth = true; // enable SMTP authentication
$mail->SMTPSecure = "ssl"; // sets the prefix to the servier
$mail->Host = "smtp.gmail.com"; // sets GMAIL as the SMTP server
$mail->Port = 465; // set the SMTP port for the GMAIL server
$mail->Username = "[email protected]"; // GMAIL username
$mail->Password = "------"; // GMAIL 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;
}
echo "Message has been sent";
?>