SMTP connect()在一个CentOS服务器上重新验证了PHPmailer上的失败错误。

时间:2022-04-04 18:12:36

My company wants to host a website on a CentOS server with a contact form and with a captcha and I stumbled upon PHPMailer. The code works on my localhost, but not on CentOS. I am getting a SMTP connect() failed error when I try to send a message to the email.

我的公司想在CentOS服务器上建立一个网站,有一个联系人表单和一个验证码,我偶然发现了PHPMailer。代码可以在本地主机上工作,但不能在CentOS上工作。当我试图向电子邮件发送消息时,会收到一个SMTP connect()失败的错误。

Also I notice when the captcha expires and when I click the checkbox again an error message was shown:

我还注意到当验证码过期时,当我再次单击复选框时,会显示一条错误消息:

Cannot contact reCaptcha. Check your connection and try again.

reCaptcha不能接触。检查连接并再次尝试。

Is it possible that it has a connection to the problem I'm having? I am still really new especially on CentOS. I've tried to google the problem, but I seem to cannot find a best solution for a fix.

它可能和我现在遇到的问题有关吗?我对CentOS还很陌生。我试图解决这个问题,但似乎找不到最好的解决办法。

1 个解决方案

#1


1  

PHPMailer has a debug setting so check this link: Debugging PHP Mail() and/or PHPMailerenter link description here + Check whether you're using SMTP (and SMTP Authentication) or just sendmail Maybe create a test script to use the simple php mail() function to run some tests to see if it's at PHP end or sendmail (exim or whatever mail server you have on the centOS box)

PHPMailer调试设置所以检查这个链接:调试PHP邮件()和/或PHPMailerenter链接描述+检查是否你使用SMTP(和SMTP认证)或sendmail可能创建一个测试脚本使用简单的PHP邮件()函数来运行一些测试,看它是否在PHP或sendmail(进出口或其他邮件服务器在centOS盒)

ReCapture is reset/cleared with the submission of your form so the first time you submit the form it will validate. The second submission it will not as it has either been cleared or changed by the first submission. If you refresh the page the reCapture will reload and you will be able to submit.

重新获得将在您的表单提交时重置/清除,以便您第一次提交表单时它将进行验证。第二次提交将不会,因为第一次提交已经被清除或修改。如果你刷新页面,重新获取将会重新加载,你将能够提交。

if you have 2 problems I would remove 1 of them and fix the one you're focusing on. Them move onto the second one. i.e. remove capture from your form and get the mail running. then add the capture component.

如果你有两个问题,我会删除其中的1个,并修正你所关注的问题。他们进入第二个。例如,从表单中删除捕获,并让邮件运行。然后添加捕获组件。

Hope that helps

希望这有助于

#1


1  

PHPMailer has a debug setting so check this link: Debugging PHP Mail() and/or PHPMailerenter link description here + Check whether you're using SMTP (and SMTP Authentication) or just sendmail Maybe create a test script to use the simple php mail() function to run some tests to see if it's at PHP end or sendmail (exim or whatever mail server you have on the centOS box)

PHPMailer调试设置所以检查这个链接:调试PHP邮件()和/或PHPMailerenter链接描述+检查是否你使用SMTP(和SMTP认证)或sendmail可能创建一个测试脚本使用简单的PHP邮件()函数来运行一些测试,看它是否在PHP或sendmail(进出口或其他邮件服务器在centOS盒)

ReCapture is reset/cleared with the submission of your form so the first time you submit the form it will validate. The second submission it will not as it has either been cleared or changed by the first submission. If you refresh the page the reCapture will reload and you will be able to submit.

重新获得将在您的表单提交时重置/清除,以便您第一次提交表单时它将进行验证。第二次提交将不会,因为第一次提交已经被清除或修改。如果你刷新页面,重新获取将会重新加载,你将能够提交。

if you have 2 problems I would remove 1 of them and fix the one you're focusing on. Them move onto the second one. i.e. remove capture from your form and get the mail running. then add the capture component.

如果你有两个问题,我会删除其中的1个,并修正你所关注的问题。他们进入第二个。例如,从表单中删除捕获,并让邮件运行。然后添加捕获组件。

Hope that helps

希望这有助于