allan.thompson99
Member
- Messages
- 43
- Reaction score
- 0
- Points
- 6
On my site I have a form which records the results of tennis matches and the user emails the contents to me using a form and PHP file which calls PHPMailer.
Sometimes it works and sometimes it doesn't and I am receiving lots of complaints!
I have the latest version of PHPMailer and thought that the problem might be with Google, whose SMTP mail servers I was using.... so I created an account at SMTP2Go and the problem seemed to be resolved - but it isn't! This morning I could receive an email from the site and this afternoon, I couldn't!
Here is my sample code:-
Here is the error that I received this afternoon:-
2014-06-26 20:21:34 SMTP ERROR: Failed to connect to server: Connection timed out (110) SMTP connect() failed. Message was not sent.Mailer error: SMTP connect() failed.
Can anyone help me to get the PHP file working correctly and reliably?
Thanks in anticipation,
Allan
Sometimes it works and sometimes it doesn't and I am receiving lots of complaints!
I have the latest version of PHPMailer and thought that the problem might be with Google, whose SMTP mail servers I was using.... so I created an account at SMTP2Go and the problem seemed to be resolved - but it isn't! This morning I could receive an email from the site and this afternoon, I couldn't!
Here is my sample code:-
PHP:
<?php
require('../../PHPmailer/class.phpmailer.php'); // path to the PHPMailer class.
require('../../PHPmailer/class.smtp.php'); // path to the PHPMailer class.
$mail = new PHPMailer();
$mail->SMTPDebug = 2;
$mail->IsSMTP();
$mail->Mailer = "smtp";
$mail->Host = "smtpcorp.com"; //Enter your SMTP2GO account's SMTP server.
$mail->Port = "2525"; // 2525, 8025, 587 and 25 can also be used. Use Port 465 for SSL.
$mail->SMTPAuth = true;
//$mail->SMTPSecure = 'ssl'; // Uncomment this line if you want to use SSL.
$mail->Username = "smtp_username";
$mail->Password = "smtp_password";
//$mail->From = "sender@example.com";
//$mail->FromName = "Susan Sender";
//$mail->AddAddress("recipient@example.com", "Rachel Recipient");
//$mail->AddReplyTo("Your Reply-to Address", "Sender's Name");
$mail->From = "FixturesSecretary@NKelsey.co.uk";
$mail->FromName = "Fixtures Secretary";
$mail->AddAddress("Allan3642@gmail.com", "FS");
$mail->AddReplyTo("FixturesSecretary@NKelsey.co.uk", "FS");
$mail->Subject = "Hi!";
$mail->Body = "Hi! How are you?";
$mail->WordWrap = 50;
if(!$mail->Send()) {
echo 'Message was not sent.';
echo 'Mailer error: ' . $mail->ErrorInfo;
exit;
} else {
echo 'Message has been sent.';
}
?>
Here is the error that I received this afternoon:-
2014-06-26 20:21:34 SMTP ERROR: Failed to connect to server: Connection timed out (110) SMTP connect() failed. Message was not sent.Mailer error: SMTP connect() failed.
Can anyone help me to get the PHP file working correctly and reliably?
Thanks in anticipation,
Allan