Phpmailer email problem, server connection not on
e-mail with Phpmailer, there are two errors ...
1.
When you bring your own code with the Phpmailer document, use the gmail,sohu,126 ... to not connect to the server
But later with QQ mailbox, can connect, also can send mail, but not stable, sometimes send failed ... Then it is estimated that the problem of the service provider ....
2. Mail sent by QQ mailbox, local 100% easy to use, uploaded to the server is not good
Tip error is SMTP error:could not connect to SMTP host.
I thought it was a php.ini problem, just looked at ...
Sendmail_from No value No value
Sendmail_path No value No value
SMTP localhost localhost
Smtp_port 25 25
The server and the local configuration is the same, why it is not good to use .... It's a very embarrassing and embarrassing.
The following code has been tested locally, can be sent, the server does not
PHP Code
Phpmailer class Require_once ("./plugin/phpmailer/class.phpmailer.php"); Require_once ("./plugin/phpmailer/ Class.smtp.php "),//Functionfunction sendmailtoclient ($client) {$mail = new Phpmailer (); $mail->issmtp (); $mail->smtpauth = true; Set to secure authentication method $mail->host = "smtp.qq.com"; SMTP server address $mail->username = "[email protected]"; Login user name $mail->password = "PSW"; Login password $mail->from = "[email protected]"; Sender address ([email protected]) $mail->fromname = "sender name"; $mail->wordwrap = 50; $mail->ishtml (TRUE); Whether HTML mail is supported, true or false $mail->addaddress ("$client"); Customer email address $mail->subject = "title"; $mail->body = "text content"; if (! $mail->send ()) {echo ' Message could not ' be sent."; echo "Mailer Error:". $mail->errorinfo; return FALSE; } return TRUE; Method call $client = "[email protected]"; Sendmailtoclient ($client);
------Solution--------------------
is the firewall not allowing you to access smtp.qq.com?
------Solution--------------------
The top bar must be a server problem.
The server and the local configuration are the same as this little suspicion
There must be a different set of places.
------Solution--------------------
Phpmailer Remember there is a debug option, the landlord set this to true to see if there are shrimp tips O (∩_∩) o~
Sloppy gather search professional paper search engine
------Solution--------------------
SMTP server with localhost? server-side configuration it should be different from the local one.
You can debug it upstairs.
Top Up