- Home /
Error: can't connect to network PHPMailer on Website
Hey everyone,
I was working on my unity3d game login system when I ran in to some trouble. I have create a php script in which a mail is send (when somebody register still need to add this part in) the scripts is uploaded on my website and I have also uploaded the full folder of the phpmailer to it, however when I try the mail with mywebsite/sendmail.php I get the error that it could connect to the network also when I replace it with ssl it says that sockets or something like that are missing. While if I call the script from my computer with localhost/sendmail.php it just works fine. I have seen other webhosters doing the same thing like inmotion hosting they have a script comparable to mines and they have uploaded the phpmailer to their site as well but for them it works just fine and for me not, does somebody has a solution to this?
Stefan
Script:
<?php
require("Link/class.phpmailer.php");
$mail = new PHPMailer();
$mail->IsSMTP();
$mail->Host = "smtp.gmail.com";
$mail->SMTPAuth = true;
$mail->SMTPSecure = "ssl";
$mail->Port = 465;
$mail->Username = "mysite@gmail.com"; // SMTP username
$mail->Password = "password"; // SMTP password
$mail->From = mysite@gmail.com;
$mail->AddAddress(addressmysite@gmail.com, "MySite");
$mail->WordWrap = 50;// set word wrap to 50 characters
$mail->IsHTML(true);// set email format to HTML
$mail->Subject = "You have received feedback from your website!";
$mail->Body = $message;
$mail->AltBody = $message;
if(!$mail->Send())
{
echo "Message could not be sent. <p>";
echo "Mailer Error: " . $mail->ErrorInfo;
exit;
}
echo "Message has been sent";
?>