如何在Hostgator上使用PHP编译器库
我正在使用PHPMailer类将电子邮件从我的联系人表单发送到我在本地主机上的gmail帐户,它工作正常。但当我把它上传到Hostgator服务器上时,我在发送电子邮件时会出错。我是否使用IP地址或主机名以及应该使用哪个端口?请帮忙 PHPMailer类如何在Hostgator上使用PHP编译器库,php,hosting,phpmailer,Php,Hosting,Phpmailer,我正在使用PHPMailer类将电子邮件从我的联系人表单发送到我在本地主机上的gmail帐户,它工作正常。但当我把它上传到Hostgator服务器上时,我在发送电子邮件时会出错。我是否使用IP地址或主机名以及应该使用哪个端口?请帮忙 PHPMailer类 require ("PHPMailer/PHPMailerAutoload.php"); //including phpmailer class $mail = new PHPMailer()
require ("PHPMailer/PHPMailerAutoload.php"); //including phpmailer class
$mail = new PHPMailer();
$mail->IsSMTP(); // set mailer to use SMTP
$mail->SMTPDebug = 2;
$mail->Host = "108.167.172.144 "; //Server IP Address
$mail->SMTPSecure = "tls"; // Connect using a TLS connection
$mail->Port = 587; //Gmail SMTP port
$mail->SMTPAuth = true; // turn on SMTP authorization
$mail->Username = "*********@gmail.com"; // SMTP username
$mail->Password = "********"; // SMTP password
$mail->From = "$em"; //email of sender
$mail->FromName = "$nm"; //name of the sender
$mail->AddAddress("********@gmail.com", "Patwan"); //email address of recepient and name
$mail->AddReplyTo($em, $nm); //Address to which recepient will reply
$mail->WordWrap = 100; // set word wrap to 100 characters
$mail->IsHTML(true); // set email format to HTML
$mail->Subject = "Contact Form"; //subject of email
$mail->Body = "Name: " . $nm .
"<br>Phone: " . $phone .
"<br>Email: " . $em .
"<br>Subject: " . $value .
"<br>Message: " . $msg ;
250-smtp.gmail.com at your service, [108.167.189.105] 250-SIZE 35882577 250-8BITMIME 250-STARTTLS 250-ENHANCEDSTATUSCODES 250-PIPELINING 250-CHUNKING 250 SMTPUTF8
2017-02-16 07:38:56 CLIENT -> SERVER: STARTTLS
2017-02-16 07:38:56 SERVER -> CLIENT: 220 2.0.0 Ready to start TLS
2017-02-16 07:38:56 CLIENT -> SERVER: EHLO www.pwebk.com
2017-02-16 07:38:56 SERVER -> CLIENT: 250-smtp.gmail.com at your service, [108.167.189.105] 250-SIZE 35882577 250-8BITMIME 250-AUTH LOGIN PLAIN XOAUTH2 PLAIN-CLIENTTOKEN OAUTHBEARER XOAUTH 250-ENHANCEDSTATUSCODES 250-PIPELINING 250-CHUNKING 250 SMTPUTF8
2017-02-16 07:38:56 CLIENT -> SERVER: AUTH LOGIN
2017-02-16 07:38:56 SERVER -> CLIENT: 334 VXNlcm5hbWU6
2017-02-16 07:38:56 CLIENT -> SERVER: bW5kdW5ndTkxQGdtYWlsLmNvbQ==
2017-02-16 07:38:56 SERVER -> CLIENT: 334 UGFzc3dvcmQ6
2017-02-16 07:38:56 CLIENT -> SERVER: bWFydGlubm4=
2017-02-16 07:38:57 SERVER -> CLIENT: 534-5.7.14 Please log in via your web browser and 534-5.7.14 then try again. 534-5.7.14 Learn more at 534 5.7.14 https://support.google.com/mail/answer/78754 c192sm2741709oih.39 - gsmtp
2017-02-16 07:38:57 SMTP ERROR: Password command failed: 534-5.7.14 Please log in via your web browser and 534-5.7.14 then try again. 534-5.7.14 Learn more at 534 5.7.14 https://support.google.com/mail/answer/78754 c192sm2741709oih.39 - gsmtp
2017-02-16 07:38:57 SMTP Error: Could not authenticate.
2017-02-16 07:38:57 CLIENT -> SERVER: QUIT
2017-02-16 07:38:57 SERVER -> CLIENT: 221 2.0.0 closing connection c192sm2741709oih.39 - gsmtp
2017-02-16 07:38:57 SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting Form could not be sent.Mailer Error: SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting
主机是'mail.domainname.com'。 港口是465。 用户名是您在hostgator上创建的电子邮件帐户之一。 密码是电子邮件帐户的密码。
SMTPsecure是“ssl”您会收到什么错误?我已经编辑了帖子并添加了错误。如果Hostgator服务器支持向Gmail发送SMTP电子邮件,请按照错误所述的链接进行操作。这个问题有许多重复。可能重复