作者 邓超

添加端口

... ... @@ -61,7 +61,7 @@ class Mail {
$this->client = new Imap();
// 处理url
$host = MailFun::getHostPort((!str_contains($this->server, '//')?'':'ssl://').$this->server,993);
$host = MailFun::getHostPort($this->server,993,'ssl://');
try {
// 是否初始成功
$this->client->login($host['host'].':'.$host['port'],$this->username,$this->password);
... ...
... ... @@ -297,7 +297,8 @@ class MailFun {
* @author:dc
* @time 2024/3/6 9:21
*/
public static function getHostPort($host,$port=0){
public static function getHostPort($host,$port=0,$ssl = 'ssl://'){
$host = ltrim($host,'/');
$arr = explode(":",$host);
if(str_contains($host, '//')){
return [
... ... @@ -307,7 +308,7 @@ class MailFun {
}else{
return [
'host' => $arr[0],
'host' => $ssl.$arr[0],
'port' => empty($arr[1]) ? $port : $arr[1],
];
}
... ...