php - Hostbuddy SMTP mail test, having troubles, could not connect to SMTP host -
i new php , im trying set postmaster, using hostbuddy hosting site , downloaded smtp information server.
i got these files them automatically uploaded server testing smtp:
class.phpmailer.php class.smtp.php index.php web.config
i think entering correct information test. keep getting callback says, "could not connect smtp server".
here index.php guys can see going on.
<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 yourname@yourdomain.com</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 { // user has submitted form include("class.phpmailer.php"); //you have upload class files "class.phpmailer.php" , "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 subject"; $mail->body = "this 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 user name , password confirm both of them correct. <br><br>"; echo "* if first time use gmail smtp send email, please refer 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 user name , password confirm both of them correct. <br>"; } else { echo "message has been sent"; } } } ?>
any info great, in advance!
you need add true smtp gmail can add :
smtp-relay.gmail.com smtp.gmail.com aspmx.l.google.com
setting requirement
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.
Comments
Post a Comment