<table cellspacing="0" cellpadding="0"><tr><td class="t_f" id="postmessage_52690"> git的push邮件简单通知钩子<br>http://www.myluoluo.com/?p=3535 <div class="blockcode"> <div id="code_g6q"><ol> <li> <?php <li>$jsonObj = json_decode($_POST['hook']);</li> <li>if ($jsonObj->password != 'HIU1234Bb76794435tON50OBOtfwq78') {</li> <li>exit('error pwd!');</li> <li>}</li> <li> <li>$mailBody = $jsonObj->push_data->user_name."提交了新的代码<br>"."项目名称:".$jsonObj->push_data->repository->name."<br>".</li> <li>'项目首页:<a href="'.%24jsonObj->push_data->repository->homepage.'">'.$jsonObj->push_data->repository->homepage.'</a><a><br>'.<li>"提交时间:".$jsonObj->push_data->commits[0]->timestamp.'<br><a href="'.%24jsonObj->push_data->commits%5B0%5D->url.'">'.<li>$jsonObj->push_data->commits[0]->url.'<a>';<li> <li>include("class.phpmailer.php");</li> <li>$mail= new PHPMailer();</li> <li>$mail->IsSMTP();</li> <li>$mail->SMTPAuth = true;</li> <li>$mail->SMTPSecure = "ssl";</li> <li>$mail->Host = "smtp.qq.com";</li> <li>$mail->Port = 465;</li> <li>$mail->CharSet = "utf-8";</li> <li>$mail->Username = "admin@myluoluo.com";</li> <li>$mail->Password = "xxxxxx";</li> <li> <li>$mail->From = "admin@myluoluo.com";</li> <li>$mail->FromName = "海棠姐姐";</li> <li> <li>$mail->Subject = "一个新的Push";</li> <li>$mail->Body = $mailBody;</li> <li>$mail->IsHTML(true);</li> <li>$mail->AddAddress("admin@myluoluo.com", "海棠姐姐");</li> <li>$mail->AddAddress("o@moe.re", "傻逼O");</li> <li> <li>if(!$mail->Send()) {</li> <li>echo "Mailer Error: " . $mail->ErrorInfo;</li> <li>} else {</li> <li>echo "Message sent!";</li> <li>}</li> <li>?></li></a> </li></a> </li></a> </li> </ol></div> <em onclick="copycode($('code_g6q'));">复制代码</em> </div> </td></tr></table> <div id="comment_52690" class="cm"> </div> <div id="post_rate_div_52690"></div> <br><br>