From bb4d099ea17bf5ac4b4035d4858259badde1026d Mon Sep 17 00:00:00 2001 From: Dirk Astrath Date: Tue, 1 Oct 2024 10:56:43 +0200 Subject: [PATCH] Add policy/CCA mail script for 2024-09-25 mailing Signed-off-by: Jan Dittberner --- scripts/send_policy_cca_20240925.php | 201 +++++++++++++++++++++++++++ 1 file changed, 201 insertions(+) create mode 100644 scripts/send_policy_cca_20240925.php diff --git a/scripts/send_policy_cca_20240925.php b/scripts/send_policy_cca_20240925.php new file mode 100644 index 0000000..0b8f4bc --- /dev/null +++ b/scripts/send_policy_cca_20240925.php @@ -0,0 +1,201 @@ +#!/usr/bin/php -q += '$lastid' + AND email not like 'a20%cacert.org' + ORDER BY `id`"; + +/* +$query = " + + SELECT `id`, `fname`, `lname`, `email` + FROM `users` + WHERE `deleted` = '0000-00-00 00:00:00' + AND `modified` != '0000-00-00 00:00:00' + AND `verified` = '1' + AND (`id` = '87908' or `id` = '12438') + + ORDER BY `id`"; + */ + +$res = mysql_query($query); + +while($row = mysql_fetch_assoc($res)) +{ + $mailtxt = "Dear ${row["fname"]} ${row["lname"]},\n".$lines_EN."\n\n"; + + sendmail($row['email'], "[CAcert.org] CAcert Inc. moved to Europe (legal information)", $mailtxt, "support@cacert.org", "", "", "CAcert", "returns@cacert.org", ""); + + $fp = fopen("send_policy_cca20240925_lastid.txt", "w"); + fputs($fp, $row["id"]."\n"); + fclose($fp); + + $count++; + echo "Sent ${count}th mail. User ID: ${row["id"]}\n"; + +// if(0 == $count % 16) { +// sleep (1); +// } + if ($count >= 3000) { + // avoid memory exhaustion -- this script has a memory leak + echo "Continue\n"; + exit(0); + } +} +echo "Stop\n";