//获取邮件发件箱SMTP信息 Monxin专用(PHP代码函数)
//本代码基于Monxin 运行
//代码来源:Monxin ./config/functions.php

function get_mail_info($pdo,$email,$id=0){
	if($id!=0){
		$sql="select * from ".$pdo->index_pre."smtp where `id`='$id'";
	}else{
		$temp=explode('@',$email);
		$postfix=$temp[1];
		$sql="select * from ".$pdo->index_pre."smtp where `postfix`='$postfix' order by `time` asc limit 0,1";	
	}
	$r=$pdo->query($sql,2)->fetch(2);
	$r=de_safe_str($r);
	if($r['url']==''){
		$sql="select * from ".$pdo->index_pre."smtp order by `time` asc limit 0,1";	
		$r=$pdo->query($sql,2)->fetch(2);	
		$r=de_safe_str($r);
	}
	if($r['url']==''){return false;}
	
	$mail_info=$r['url']."|".$r['username']."|".$r['password'];
		$sql="update ".$pdo->index_pre."smtp set `time`=`time`+1 where `id`=".$r['id'];
		$pdo->exec($sql);
	return $mail_info;
}

声明:本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。