PHPMailer uses QQ mail to send mails. phpmailer can send mails.
The example in this article shares with you the specific code for sending mails using PHPMailer via QQ mail for your reference. The specific content is as follows:
/*** Place an order to send an email * @ to recipient @ title @ content */function sendMail ($ to, $ title, $ content) {// introduce the PHPMailer core file and use require_once to include the warning require_once (".. /.. /shortdes/phpmailer/5.1/class. phpmailer. php "); require_once (".. /.. /shortdes/phpmailer/5.1/class. smtp. php "); // instantiate the PHPMailer core class $ mail = new PHPMailer (); // whether to enable smtp debug for debugging the development environment. We recommend that you enable the production environment annotation to disable the debug debugging mode by default. $ mail-> SMTPDebug = 1; // use smtp authentication to send an email $ mail-> isSMTP (); // you can use ssl encryption to log on to authentication $ mail-> SMTPSecure = 'ssl '; // smtp authentication must be true $ mail-> SMTPAuth = true; // link the server address of the qq domain name mailbox // $ mail-> Host = 'smtp .qq.com '; $ mail-> Host = 'smtp .exmail.qq.com '; 25 // set the remote server port number for ssl connection to the smtp server. The default value is 25, but now the new one seems to be unavailable. Optional values: 465 or 587 $ mail-> Port = 465; // set the smtp helo message header, which can have no content. // $ mail-> Helo = 'Hello smtp.qq.com Server'; // set the sender's host domain to have any content without localhost by default, we recommend that you use your domain name $ mail-> Hostname = 'localhost '; // set the encoding of the sent email. Optional. GB2312. I like UTF-8. It is said that utf8 will garbled characters in some clients. $ mail-> CharSet = 'utf-8 '; // set the sender's name (nickname) to any content, and display the sender's name before the recipient's email address $ mail-> FromName = 'tang Ren Fang Xin '; // enter the QQ number in string format for the smtp Logon account $ mail-> Username = '123 '; // use the generated authorization code for the smtp logon Password (the latest authorization code you just saved) $ mail-> Password = '123 '; // set the sender's email address. Enter the aforementioned "sender's email address" $ mail-> From = '2017 @ qq.com '; // whether the email body is html encoded. Note that a method is no longer a property of true or false $ mail-> isHTML (true ); // set the recipient's email address. This method has two parameters. The first parameter is the recipient's email address. The second parameter is the nickname set for this address. Different email addresses are automatically processed and changed. Here, the second parameter is used. not significant $ mail-> addAddress ($, ''); // Add multiple recipients to call the method multiple times. $ mail-> addAddress ('2017 @ qq.com ',''); $ mail-> addAddress ('1970 @ qq.com ', ''); $ mail-> addAddress ('1970 @ qq.com ',''); $ mail-> addAddress ('1970 @ qq.com ', ''); // Add the Subject of the email $ mail-> Subject = $ title; // set isHTML to true at the top of the email Body, which can be a complete html string. For example, use the file_get_contents function to read the local html file $ mail-> Body = $ content; // Add an attachment to the email. This method also has two parameters. The first parameter is the directory where the attachment is stored (either relative directory or absolute directory) the second parameter is the name of the attachment in the email attachment // $ mail-> addAttachment ('. /d.jpg','mm.jpg '); // you can call this method multiple times to upload multiple attachments. // $ mail-> addAttachment ('. /Jlib-1.1.0.js ', 'jlib. js '); $ mail-> send (); // simple judgment and prompt information if ($ status) {return true ;} else {return false ;}}
// Call the method to send an email $ this-> sendMail ('1970 @ qq.com ', 'you have a new order', "Administrator, you have a new online payment order waiting for processing, the Order Number is ". $ order_sn );
The above is all the content of this article. I hope it will be helpful for your learning and support for helping customers.