feat(mailing): Kundenrundmail mit Empfängern aus Buchungen, Abmeldelink und Versandprotokoll
Empfänger kommen aus bookings.email (dedupliziert, ohne Abmeldungen), Text mit
{jahr}, Testmail an die eigene Adresse, Versand in Häppchen über mail_send().
Abmeldungen landen in mail_optouts und gelten für alle künftigen Rundmails.
Migration 009_mailing.sql, DSGVO-Verzeichnis und ROADMAP (Feature 18) ergänzt.
This commit is contained in:
parent
1adc3c8f33
commit
5cce6ca86f
11 changed files with 657 additions and 1 deletions
35
sql/migrations/009_mailing.sql
Normal file
35
sql/migrations/009_mailing.sql
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
-- Kundenrundmail: Sperrliste (Abmeldungen) und Versandprotokoll.
|
||||
-- Empfänger sind nicht gespeichert – sie werden je Kampagne aus bookings.email
|
||||
-- gezogen (siehe app/mailing.php).
|
||||
|
||||
CREATE TABLE IF NOT EXISTS mail_optouts (
|
||||
email VARCHAR(190) NOT NULL,
|
||||
source VARCHAR(40) NOT NULL DEFAULT '',
|
||||
created_at DATETIME NOT NULL,
|
||||
PRIMARY KEY (email)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS mailings (
|
||||
id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||
subject VARCHAR(190) NOT NULL,
|
||||
body TEXT NOT NULL,
|
||||
recipient_count INT UNSIGNED NOT NULL DEFAULT 0,
|
||||
sent_count INT UNSIGNED NOT NULL DEFAULT 0,
|
||||
failed_count INT UNSIGNED NOT NULL DEFAULT 0,
|
||||
created_at DATETIME NOT NULL,
|
||||
created_by BIGINT UNSIGNED NULL DEFAULT NULL,
|
||||
finished_at DATETIME NULL DEFAULT NULL,
|
||||
PRIMARY KEY (id),
|
||||
KEY idx_mailings_created (created_at)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS mailing_recipients (
|
||||
mailing_id BIGINT UNSIGNED NOT NULL,
|
||||
email VARCHAR(190) NOT NULL,
|
||||
status ENUM('pending', 'sent', 'failed') NOT NULL DEFAULT 'pending',
|
||||
error VARCHAR(190) NOT NULL DEFAULT '',
|
||||
sent_at DATETIME NULL DEFAULT NULL,
|
||||
PRIMARY KEY (mailing_id, email),
|
||||
KEY idx_mailing_recipients_status (mailing_id, status),
|
||||
CONSTRAINT fk_mailing_recipients_mailing FOREIGN KEY (mailing_id) REFERENCES mailings (id) ON DELETE CASCADE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
||||
Loading…
Add table
Add a link
Reference in a new issue