/*
*检查路径是否存在
*/
function checkDir($dir)
{
exec("/bin/ls $dir", $info, $status);
$sta = empty($info) ? $sta = 1 : $sta = 0;//1路径不存在,0路径存在
return $sta;
}
//仓库是git还是svn
function warehouseCheck($warehouse)
{
if (preg_match("/.git$/i", $warehouse)) {
$sta = 1; //1为git
}
if (preg_match("/^svn:\/\//i", $warehouse)) {
$sta = 2; //2为svn
}
return $sta;
}
//环境选择
function envCheck($env_name, $ser_tmp)
{
if (strpos($env_name, "测试") !== false) {
$dir_tmp = "$ser_tmp/cs";
} elseif (strpos($env_name, "预发布") !== false) {
$dir_tmp = "$ser_tmp/yfb";
} elseif (strpos($env_name, "正式") !== false || strpos($env_name, "线上") !== false) {
$dir_tmp = "$ser_tmp/zs";
} else {
$dir_tmp = "";
}
return $dir_tmp;
}
//发邮件
function sendMail($to, $subject, $content,$send_user){
header("content-type:text/html;charset=utf-8");
ini_set("magic_quotes_runtime",0);
vendor("Phpmailer.phpmailer");
try {
$mail = new PHPMailer(true);//实例化
$mail->IsSMTP();// 启用SMTP
$mail->CharSet='UTF-8'; //设置邮件的字符编码,这很重要,不然中文乱码
$mail->SMTPAuth = true; //开启认证
$mail->Port = 25;
$mail->Host = "smtp.exmail.qq.com";
$mail->Username = "ops@feibo.cn";
$mail->Password = "feibo54321";
//$mail->IsSendmail(); //如果没有sendmail组件就注释掉,否则出现“Could not execute: /var/qmail/bin/sendmail ”的错误提示
//$mail->AddReplyTo("phpddt1990@163.com","mckee");//回复地址
$mail->From = "ops@feibo.cn";
$mail->FromName = $send_user;
//$to = "linc@feibo.cn";
//dump($to);die;
foreach($to as $v){
$mail->AddAddress($v);
}
$content = str_replace('\n',"\n",$content);
$mail->IsHTML(true); //支持html格式内容
$mail->Subject = $subject;
$mail->Body = $content;
//$mail->AltBody = "To view the message, please use an HTML compatible email viewer!"; //当邮件不支持html时备用显示,可以省略
$mail->WordWrap = 80; // 设置每行字符串的长度
//$mail->AddAttachment("f:/test.png"); //可以添加附件
$mail->Send();
} catch (phpmailerException $e) {
echo "邮件发送失败:".$e->errorMessage();
}
}
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。