6 Commits

Author SHA1 Message Date
Troy grunt
97c21a4894 gitea stuff 2025-12-31 01:47:32 +01:00
electronicfreak
560ef6589c add troy api 2024-04-04 19:53:41 +02:00
troy
e4a21f4d7c mail absender 2022-12-18 19:29:34 +01:00
troy
c2e488c8e7 added functional php mail 2022-12-18 19:04:18 +01:00
troy
59b5ffc82f mail return werte gesetzt 2022-11-12 11:25:42 +01:00
troy
2913f3f032 mail boundary auskommentiert 2022-11-12 11:22:56 +01:00
3 changed files with 37 additions and 14 deletions

View File

@@ -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');
?>

View File

@@ -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!';
}
}
?>

View File

@@ -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);
}
?>