...
|
...
|
@@ -238,4 +238,39 @@ class MailFun { |
|
|
return $oldStr == base64_encode(base64_decode($str));
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 测试登录
|
|
|
* @param $smtp
|
|
|
* @param $email
|
|
|
* @param $password
|
|
|
* @return bool
|
|
|
* @author:dc
|
|
|
* @time 2023/11/7 10:47
|
|
|
*/
|
|
|
public static function smtpLoginTest($smtp,$email,$password){
|
|
|
|
|
|
// 邮件对象
|
|
|
$mail = new PHPMailer();
|
|
|
//Server settings
|
|
|
$mail->SMTPDebug = SMTP::DEBUG_OFF;//调试输出 SMTP::DEBUG_SERVER; //Enable verbose debug output
|
|
|
$mail->isSMTP(); //Send using SMTP
|
|
|
$mail->Host = $smtp; //Set the SMTP server to send through
|
|
|
$mail->SMTPAuth = true; //Enable SMTP authentication
|
|
|
$mail->Username = $email; //SMTP username
|
|
|
$mail->Password = $password; //SMTP password
|
|
|
$mail->SMTPSecure = PHPMailer::ENCRYPTION_SMTPS; //Enable implicit TLS encryption
|
|
|
$mail->Port = 465; //TCP port to connect to; use 587 if you have set `SMTPSecure = PHPMailer::ENCRYPTION_STARTTLS`
|
|
|
$mail->CharSet = 'utf-8';
|
|
|
$mail->Encoding = PHPMailer::ENCODING_QUOTED_PRINTABLE;
|
|
|
|
|
|
try {
|
|
|
return $mail->smtpConnect();
|
|
|
}catch (\Throwable $e){}
|
|
|
|
|
|
return false;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
} |
...
|
...
|
|