mirror of
https://codeberg.org/Sonoj/osamc.de
synced 2025-07-15 14:02:09 +02:00
personal reminder script
This commit is contained in:
parent
edfb1f90eb
commit
dc34270ba4
32
second_wednesday.php
Normal file
32
second_wednesday.php
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
<?php
|
||||||
|
// Simple PHP script to email yourself on every second Wednesday of each month
|
||||||
|
|
||||||
|
function isSecondWednesday() {
|
||||||
|
$timezone = new DateTimeZone('Europe/Berlin');
|
||||||
|
$today = new DateTime('now', $timezone);
|
||||||
|
|
||||||
|
$month = $today->format('n');
|
||||||
|
$year = $today->format('Y');
|
||||||
|
|
||||||
|
// Find the second Wednesday
|
||||||
|
$secondWednesday = new DateTime("second Wednesday of $year-$month", $timezone);
|
||||||
|
|
||||||
|
return $today->format('Y-m-d') === $secondWednesday->format('Y-m-d');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isSecondWednesday()) {
|
||||||
|
// Configure your email details
|
||||||
|
$to = "nils@hilbricht.net";
|
||||||
|
$subject = "Erinnerung: OSAMC Einladung schreiben";
|
||||||
|
$message = "Nächste Woche ist OSAMC, bitte einladen.";
|
||||||
|
$headers = "From: nils@hilbricht.net\r\n"; // You might need a valid domain email
|
||||||
|
|
||||||
|
// Send the email
|
||||||
|
mail($to, $subject, $message, $headers);
|
||||||
|
}
|
||||||
|
|
||||||
|
// If you want output when running manually:
|
||||||
|
if (__FILE__ == realpath($_SERVER['SCRIPT_FILENAME'])) {
|
||||||
|
echo isSecondWednesday() ? "Email sent (or would have been sent) today.\n" : "Today is not the second Wednesday.\n";
|
||||||
|
}
|
||||||
|
?>
|
Loading…
x
Reference in New Issue
Block a user