坑爹,代码高亮不能用了,发个编辑器的截图好了,哈哈哈
代码在下面:
<?php
$jsonObj = json_decode($_POST['hook']);
if ($jsonObj->password != 'HIUBb7679bON50OBOtfwq78') {
exit('error pwd!');
}
$mailBody = "${$jsonObj->push_data->user_name} 提交了新的代码<br/>项目名称:"."项目名称: ${$jsonObj->push_data->repository->name}<br/>"
. "项目首页:<a href=\"${$jsonObj->push_data->repository->homepage}\">${$jsonObj->push_data->repository->homepage}<a><br/>"
. "提交时间:${$jsonObj->push_data->commits[0]->timestamp}<br/>"
. "<a href=\"${$jsonObj->push_data->commits[0]->url}\">${$jsonObj->push_data->commits[0]->url}<a>";
include("class.phpmailer.php");
$mail= new PHPMailer();
$mail->IsSMTP();
$mail->SMTPAuth = true;
$mail->SMTPSecure = "ssl";
$mail->Host = "smtp.qq.com";
$mail->Port = 465;
$mail->CharSet = "utf-8";
$mail->Username = "[email protected]";
$mail->Password = "xxxxxx";
$mail->From = "[email protected]";
$mail->FromName = "海棠姐姐";
$mail->Subject = "一个新的Push";
$mail->Body = $mailBody;
$mail->IsHTML(true);
$mail->AddAddress("[email protected]", "海棠姐姐");
$mail->AddAddress("[email protected]", "傻逼O");
if(!$mail->Send()) {
echo "Mailer Error: " . $mail->ErrorInfo;
} else {
echo "Message sent!";
}
?>
效果图:
恩,确实很简单,哈哈哈哈
自动给来访者发邮件?
不是,是针对git的push hook做的一个邮件提醒跟网站没关系噢
我擦,我刚以为这代码高亮太炫了,竟然还能放大!!!!!竟然是张图。。
你可以开发个这功能
我赞同
代码高亮坏掉了o(╯□╰)o
这代码有点长