Phpmailer is a great open source messaging class, and it's very simple to use, but for a virtual host, there are always restrictions. Just now I encountered an "SMTP error:could not connect to SMTP host" error using Phpmailer on a virtual host. Here are two ways to fix this:
(1) The server cannot send mail using SMTP
Workaround: Many sites listed the solution is because of the SMTP case, although the nature of the problem is not here, but do need to change this place, as for why, look at the following operation.
In class.phpmailer.php, you will:
function Issmtp () {$this->mailer= ' SMTP ';}
Change to:
function Issmtp () {$this->mail
(1) The server cannot send emails using smtp.
Solution: the solution listed by many websites is due to the smtp case sensitivity problem. Although the problem is not here in essence, it must be changed. For the reason, refer to the following operations.
In class. phpmailer. php, set:
function IsSMTP(){$this->Mailer='smtp';}
Changed:
function IsSMTP(){$this->Maile
Cause analysisIf this problem occurs, the name of the SMTP host Solution: It depends on the email payment does not support sending and receiving mails by pop3. This can be viewed officially by email, such as QQ mail.Phpmailer error SMTP Error: cocould not connect to SMTP host
SMTP error:could not connect to SMTP host.
I use the Web page runtime Normal, can send, with the command to run PHP file times wrong, the main code is checked correctly, as follows
function SendMail ($setEmail, $setName, $body, $subject) {Require_once ("phpmail/phpmailer.php");$mail = new Phpmailer (true); The true param means it would throw exceptions on errors
Php PHPMailer sends an Email and cannot connect to the host because the fsockopen function is disabled. PHPmailer sends an Email based on this function.
Modify:
Class. stmp. php
Solution:
1:
Row 3:
$ This-> smtp_conn = fsockopen ($ host, // the host of the server
Changed:
$ This-> smtp_conn = pfsockopen ($ host
PHP Phpmailer Send the message, there is no connection to host, this is because the Fsockopen function is disabled, Phpmailer send email dependent on this function.
Modify:
class.stmp.php
Solve:
1:
118 lines:
$this->smtp_conn = Fsockopen ($host,//The host of the server
Switch
$this->smtp_conn = Pfsockopen ($host,//The
PHP phpmailer sends an email and cannot connect to the host because the fsockopen function is disabled. phpmailer sends an email based on this function.
Modify:
Class. stmp. php
Solution:
1:
Row 3:
$ This-> smtp_conn = fsockopen ($ host, // the host of the server
Changed:
$ This-> smtp_conn = pfsockopen ($ host
HiChina hosts all seem to need to send emails through SMTP, and enable fsockopen. However, the SMTP sending method of WordPress is steam_connect_client instead of fsockopen.
HiChina hosts all seem to need to send emails through SMTP, and to enable fsockopen (this can be enabled in HiChina background. if not, please contact HiChina customer service ). But the
#---------------------------------------------------------------------- --------------
# Encryption key cannot be given
# The username and password are encrypted and decrypted tools are in the Desutil
#--------------------------------------- ---------------------------------------------
#登陆用户名 I wrote it casually,
mail.smtp.username=. cboch2llydmw2432vyrede4tjvjrstamcoe123111
#密码 QQ for authorization code 111111 I wrote it casually
mail.smtp.password= avq5jebimunr5f4wcllzza==
problems encounte
Using DEDECMS to customize a Send mail php file, using the dedecms comes with mail.class.php, can be sent locally, after uploading to the server, prompted cannot connenct to relay host Smtp.qq.com Error: () error:cannot send email to [email protected] online to find a lot of articles, finally solved, the problem is in the server environment configuration. Find php.ini, see two places, one is Allow_url_fopen, this place is to be set to on, and the othe
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.