Compare commits
6 Commits
67a39afe0f
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
97c21a4894 | ||
|
|
560ef6589c | ||
|
|
e4a21f4d7c | ||
|
|
c2e488c8e7 | ||
|
|
59b5ffc82f | ||
|
|
2913f3f032 |
@@ -6,5 +6,6 @@ include_once ('string.php');
|
||||
include_once ('numbers.php');
|
||||
include_once ('mail.php');
|
||||
include_once ('debug.php');
|
||||
include_once ('troy-api.php');
|
||||
// include_once ('markdown.php');
|
||||
?>
|
||||
15
mail.php
15
mail.php
@@ -58,29 +58,19 @@ function send_html_mail($an, $betreff, $text, $ok = '', $error = '') {
|
||||
}
|
||||
|
||||
function send_php_mail($an, $betreff, $text, $ok = '', $error = '') {
|
||||
$boundary = md5($an.$betreff.$text.time());
|
||||
include 'secret.php';
|
||||
global $_sendermail;
|
||||
$sender = 'noreply@troy-grunt.de';
|
||||
if (isset ( $_sendermail )) {
|
||||
$sender = $_sendermail;
|
||||
}
|
||||
include 'php-mailer/SMTP.php';
|
||||
include 'php-mailer/PHPMailer.php';
|
||||
$mail = new PHPMailer();
|
||||
$mail->isSMTP();
|
||||
$mail->SMTPDebug = SMTP::DEBUG_OFF;
|
||||
$mail->Host = $_smtp['srv'];
|
||||
$mail->Port = 25;
|
||||
$mail->SMTPAuth = true;
|
||||
$mail->Username = $_smtp['user'];
|
||||
$mail->Password = $_smtp['pw'];
|
||||
|
||||
$mail->setFrom($sender);
|
||||
$mail->addAddress($an);
|
||||
$mail->Subject = $betreff;
|
||||
$mail->msgHTML('<html><body>'.$text.'</body></html>');
|
||||
$mail->msgHTML($text, __DIR__);
|
||||
$mail->AltBody = strip_tags($text);
|
||||
//$mail->addAttachment('images/phpmailer_mini.png');
|
||||
|
||||
if (!$mail->send()) {
|
||||
echo 'Mailer Error: ' . $mail->ErrorInfo;
|
||||
@@ -88,5 +78,4 @@ function send_php_mail($an, $betreff, $text, $ok = '', $error = '') {
|
||||
echo 'Message sent!';
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
33
troy-api.php
33
troy-api.php
@@ -13,4 +13,37 @@ function sendToTroy($data) {
|
||||
$context = stream_context_create ( $options );
|
||||
return file_get_contents ( $url, false, $context );
|
||||
}
|
||||
|
||||
function sendToGitea($title, $message) {
|
||||
// secret.php liegt in lib/
|
||||
require 'secret.php';
|
||||
|
||||
$url = rtrim($giteaUrl, '/') . "/repos/$giteaOwner/$giteaRepo/issues";
|
||||
|
||||
$data = [
|
||||
"title" => $title,
|
||||
"body" => $message
|
||||
];
|
||||
|
||||
$options = [
|
||||
'http' => [
|
||||
'method' => 'POST',
|
||||
'header' => [
|
||||
"Content-Type: application/json",
|
||||
"Authorization: token $giteaToken"
|
||||
],
|
||||
'content' => json_encode($data)
|
||||
]
|
||||
];
|
||||
|
||||
$context = stream_context_create($options);
|
||||
$result = file_get_contents($url, false, $context);
|
||||
|
||||
if ($result === FALSE) {
|
||||
throw new Exception("Fehler beim Erstellen der Anfrage");
|
||||
}
|
||||
|
||||
return json_decode($result, true);
|
||||
}
|
||||
|
||||
?>
|
||||
Reference in New Issue
Block a user