hamed72900
دوشنبه 28 اسفند 1391, 14:39 عصر
سلام
من برای فرم contact از phpmailer استفاده کردم ولی همش بهم این ارورو میده :
SMTP Error: Could not connect to SMTP host. Message could not be sent.
Mailer Error: SMTP Error: Could not connect to SMTP host.
اینم کدیه که میزنم :
<?php
require("phpmailer/class.phpmailer.php");
$mail = new PHPMailer();
$mail->IsSMTP(); // set mailer to use SMTP
$mail->Host = "smtp.gmail.com"; // specify main and backup server
$mail->Port = "465"; // SMTP Port
$mail->SMTPAuth = true; // turn on SMTP authentication
$mail->SMTPSecure= "ssl"; // SMTP connection type
$mail->Username = "mygmail@gmail.com"; // SMTP username
$mail->Password = "mypass"; // SMTP password
// Send email to :
$mail->AddAddress("myid@yahoo.com"); // will receive the test email
$mail->WordWrap = 50; // set word wrap to 50 characters
$mail->Subject = "Here is the subject";
$mail->Body = "This is the HTML message body <b>in bold!</b>";
$mail->AltBody = "This is the body in plain text for non-HTML mail clients";
if(!$mail->Send())
{
echo "Message could not be sent. <p>";
echo "Mailer Error: " . $mail->ErrorInfo;
exit;
}
echo "Message has been sent";
echo <<<_END
<html>
<form method="post" action="">
<input type="text" name="subject" value="subject"/>
<input type="text" name="from" value="email"/>
<input type="text" name="name" value="name"/>
<input type="text" name="body" value="body"/>
<input type="submit" value="send"/>
</form>
</html>
_END;
?>
SOME BODY HEEEEEEEEELP MEEEEEEE
من برای فرم contact از phpmailer استفاده کردم ولی همش بهم این ارورو میده :
SMTP Error: Could not connect to SMTP host. Message could not be sent.
Mailer Error: SMTP Error: Could not connect to SMTP host.
اینم کدیه که میزنم :
<?php
require("phpmailer/class.phpmailer.php");
$mail = new PHPMailer();
$mail->IsSMTP(); // set mailer to use SMTP
$mail->Host = "smtp.gmail.com"; // specify main and backup server
$mail->Port = "465"; // SMTP Port
$mail->SMTPAuth = true; // turn on SMTP authentication
$mail->SMTPSecure= "ssl"; // SMTP connection type
$mail->Username = "mygmail@gmail.com"; // SMTP username
$mail->Password = "mypass"; // SMTP password
// Send email to :
$mail->AddAddress("myid@yahoo.com"); // will receive the test email
$mail->WordWrap = 50; // set word wrap to 50 characters
$mail->Subject = "Here is the subject";
$mail->Body = "This is the HTML message body <b>in bold!</b>";
$mail->AltBody = "This is the body in plain text for non-HTML mail clients";
if(!$mail->Send())
{
echo "Message could not be sent. <p>";
echo "Mailer Error: " . $mail->ErrorInfo;
exit;
}
echo "Message has been sent";
echo <<<_END
<html>
<form method="post" action="">
<input type="text" name="subject" value="subject"/>
<input type="text" name="from" value="email"/>
<input type="text" name="name" value="name"/>
<input type="text" name="body" value="body"/>
<input type="submit" value="send"/>
</form>
</html>
_END;
?>
SOME BODY HEEEEEEEEELP MEEEEEEE