저는 PHP에 익숙하며 postmaster를 설정하려고합니다. 내 호스팅 사이트에 Hostbuddy를 사용하고 내 서버에 smtp 정보를 다운로드했습니다.문제가있는 Hostbuddy SMTP 메일 테스트가 SMTP 호스트에 연결할 수 없습니다.
class.phpmailer.php
class.smtp.php
index.php
web.config
내가 시험에 대한 올바른 정보를 입력하고 생각 :
나는 자동으로 SMTP를 테스트하기 위해 내 서버에 업로드 그들로부터 이러한 파일을 얻었다. 하지만 "콜백 서버에 연결할 수 없습니다."라는 콜백이 계속 나타납니다.여기 index.php가 있습니다. 그래서 여러분들은 무슨 일이 일어나고 있는지 볼 수 있습니다.
<Center><h2>PHP Test Email Script</h2></center>
<?php
// display form if user has not clicked submit
if (!isset($_POST["submit"])) {
?>
<form method="post" action="<?php echo $_SERVER["PHP_SELF"];?>" target="_blank">
<Table align = center>
<tr><td>From Email: <td><input type="text" name="uname"> i.e [email protected]</tr>
<tr><td>Email Password: <td><input type="password" name="pass"></tr>
<tr><td>Host: <td><input type="text" name="host"> i.e Mail.YourDomain.com</tr>
<tr><td>To:<td> <input type="text" name="to"></tr>
<tr><td colspan =2 align = center><input type="submit" name="submit" value="Send Email"></tr>
</table>
</form>
<?php
}
else { // the user has submitted the form
include("class.phpmailer.php"); //you have to upload class files "class.phpmailer.php" and "class.smtp.php"
$mail = new PHPMailer();
$mail->IsSMTP();
$mail->SMTPAuth = true;
$mail->Host = $_POST["host"];
$mail->Username = $_POST["uname"];
$mail->Password = $_POST["pass"];
$mail->From = $_POST["uname"];
$mail->FromName = "demouser";
$mail->AddAddress($_POST["to"],"test");
$mail->Subject = "This is the subject";
$mail->Body = "This is a sample message using SMTP authentication";
$mail->WordWrap = 50;
$mail->IsHTML(true);
$str1= "gmail.com";
$str2=strtolower($_POST["uname"]);
If(strstr($str2,$str1))
{
$mail->SMTPSecure = 'tls';
$mail->Port = 587;
if(!$mail->Send()) {
echo "Mailer Error: " . $mail->ErrorInfo;
echo "<br><br> * Please double check the user name and password to confirm that both of them are correct. <br><br>";
echo "* If you are the first time to use gmail smtp to send email, please refer to this link :http://www.smarterasp.net/support/kb/a1546/send-email-from-gmail-with-smtp-authentication-but-got-5_5_1-authentication-required-error.aspx?KBSearchID=137388";
}
else {
echo "Message has been sent";
}
}
else{
$mail->Port = 25;
if(!$mail->Send()) {
echo "Mailer Error: " . $mail->ErrorInfo;
echo "<br><BR>* Please double check the user name and password to confirm that both of them are correct. <br>";
}
else {
echo "Message has been sent";
}
}
}
?>
아무 정보 나 미리 감사드립니다. 당신이 추가 할 수 있도록
이 답변은 도움이 될 수 있습니까 (아니면 속임수?) : https://stackoverflow.com/questions/13489037/could-not-connect-to-smtp-host?rq=1 – Jeff