2017-09-14 3 views
0

저는 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"; 
} 
} 
} 
?> 

아무 정보 나 미리 감사드립니다. 당신이 추가 할 수 있도록

+0

이 답변은 도움이 될 수 있습니까 (아니면 속임수?) : https://stackoverflow.com/questions/13489037/could-not-connect-to-smtp-host?rq=1 – Jeff

답변

0

당신은 진정한 SMTP에 Gmail을 추가해야합니다

smtp-relay.gmail.com smtp.gmail.com aspmx.l.google.com 

설정 요구 사항

Options : port 25, 465 ou 587 
Protocoles SSL/TLS (Secure Socket Layer/Transport Layer Security) 

Port 465 (SSL require). 
Port 587 (TLS require). 
Adresses dynamic IP allowed. 

Port 25. 
TLS no require. 
Adresses dynamic IP allowed. 
0

내가 올바르게 설정했다처럼, 그냥 hostbuddy 몇 시간이 걸렸다 보이는 smtp 서버를 설치하십시오. 훌륭한 작품들 :) 제안에 감사드립니다!

관련 문제