| 
@@ -238,4 +238,39 @@ class MailFun { | 
 | 
@@ -238,4 +238,39 @@ class MailFun { | 
| 
238
 | 
         return $oldStr == base64_encode(base64_decode($str));
 | 
238
 | 
         return $oldStr == base64_encode(base64_decode($str));
 | 
| 
239
 | 
     }
 | 
239
 | 
     }
 | 
| 
240
 | 
 
 | 
240
 | 
 
 | 
| 
 | 
   | 
241
 | 
+
 | 
| 
 | 
   | 
242
 | 
+    /**
 | 
| 
 | 
   | 
243
 | 
+     * 测试登录
 | 
| 
 | 
   | 
244
 | 
+     * @param $smtp
 | 
| 
 | 
   | 
245
 | 
+     * @param $email
 | 
| 
 | 
   | 
246
 | 
+     * @param $password
 | 
| 
 | 
   | 
247
 | 
+     * @return bool
 | 
| 
 | 
   | 
248
 | 
+     * @author:dc
 | 
| 
 | 
   | 
249
 | 
+     * @time 2023/11/7 10:47
 | 
| 
 | 
   | 
250
 | 
+     */
 | 
| 
 | 
   | 
251
 | 
+    public static function smtpLoginTest($smtp,$email,$password){
 | 
| 
 | 
   | 
252
 | 
+
 | 
| 
 | 
   | 
253
 | 
+        // 邮件对象
 | 
| 
 | 
   | 
254
 | 
+        $mail = new PHPMailer();
 | 
| 
 | 
   | 
255
 | 
+        //Server settings
 | 
| 
 | 
   | 
256
 | 
+        $mail->SMTPDebug = SMTP::DEBUG_OFF;//调试输出  SMTP::DEBUG_SERVER;                    //Enable verbose debug output
 | 
| 
 | 
   | 
257
 | 
+        $mail->isSMTP();                                            //Send using SMTP
 | 
| 
 | 
   | 
258
 | 
+        $mail->Host       = $smtp;                     //Set the SMTP server to send through
 | 
| 
 | 
   | 
259
 | 
+        $mail->SMTPAuth   = true;                                   //Enable SMTP authentication
 | 
| 
 | 
   | 
260
 | 
+        $mail->Username   = $email;                     //SMTP username
 | 
| 
 | 
   | 
261
 | 
+        $mail->Password   = $password;                               //SMTP password
 | 
| 
 | 
   | 
262
 | 
+        $mail->SMTPSecure = PHPMailer::ENCRYPTION_SMTPS;            //Enable implicit TLS encryption
 | 
| 
 | 
   | 
263
 | 
+        $mail->Port       = 465;                                    //TCP port to connect to; use 587 if you have set `SMTPSecure = PHPMailer::ENCRYPTION_STARTTLS`
 | 
| 
 | 
   | 
264
 | 
+        $mail->CharSet = 'utf-8';
 | 
| 
 | 
   | 
265
 | 
+        $mail->Encoding = PHPMailer::ENCODING_QUOTED_PRINTABLE;
 | 
| 
 | 
   | 
266
 | 
+
 | 
| 
 | 
   | 
267
 | 
+        try {
 | 
| 
 | 
   | 
268
 | 
+            return $mail->smtpConnect();
 | 
| 
 | 
   | 
269
 | 
+        }catch (\Throwable $e){}
 | 
| 
 | 
   | 
270
 | 
+
 | 
| 
 | 
   | 
271
 | 
+        return false;
 | 
| 
 | 
   | 
272
 | 
+
 | 
| 
 | 
   | 
273
 | 
+    }
 | 
| 
 | 
   | 
274
 | 
+
 | 
| 
 | 
   | 
275
 | 
+
 | 
| 
241
 | 
 } | 
276
 | 
 } |