/** * Function: System mail Send function * @param string $to incoming mail person mailbox * @param string $name Recipient name * @param string $subject message subject * @param str ing $body Mail content * @param string $attachment Attachment list * @return Boolean */function send_mail ($to, $name, $subject = ', $body = ', $attachment = null, $config = ') {$config = Is_array ($config)? $config: C (' System_email '); Import (' Phpmailer.phpmailer ', vendor_path); From Phpmailer directory class.phpmailer.php class file $mail = new Phpmailer (); Phpmailer object $mail->charset = ' UTF-8 '; Set the message encoding, the default iso-8859-1, if the text must be set in Chinese, otherwise garbled $mail->issmtp (); Set the SMTP service to use//$mail->ishtml (TRUE); $mail->smtpdebug = 0; Turn off the SMTP debugging feature 1 = errors and Messages2 = messages only $mail->smtpauth = true; Enable the SMTP authentication feature if ($config [' smtp_port '] = = 465) $mail->smtpsecure = ' SSL '; Using the security protocol $mail-&Gt Host = $config [' Smtp_host ']; SMTP server $mail->port = $config [' Smtp_port ']; The port number of the SMTP server $mail->username = $config [' Smtp_user ']; SMTP Server user name $mail->password = $config [' Smtp_pass ']; SMTP server password $mail->setfrom ($config [' From_email '], $config [' from_name ']); $replyEmail = $config [' Reply_email ']? $config [' Reply_email ']: $config [' reply_email ']; $replyName = $config [' Reply_name ']? $config [' Reply_name ']: $config [' reply_name ']; $mail->addreplyto ($replyEmail, $replyName); $mail->subject = $subject; $mail->msghtml ($body); $mail->addaddress ($to, $name); if (Is_array ($attachment)) {//Add attachment foreach ($attachment as $file) {if (Is_array ($file)) { Is_file ($file [' path ']) && $mail->addattachment ($file [' Path '], $file [' name ']); } else {is_file ($file) && $mail->addattachment ($file); } }} else {is_file ($attachment) && $mail->addattachment ($attachment); } return $mail->send ()? true: $mail->errorinfo;}