feat: SMTP mail stack and separate server.env deploy
Add mail.php with STARTTLS sending, test scripts, server.env split from local .env, admin@ postbox docs, DKIM DNS support-ticket notes, and todo 11 for boka relay. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Executable
+39
@@ -0,0 +1,39 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* Send a test mail using local .env (this machine only).
|
||||
* Usage: php scripts/test-mail.php
|
||||
*/
|
||||
|
||||
$root = dirname(__DIR__);
|
||||
require_once "{$root}/config/mail.php";
|
||||
|
||||
$to = env('ALERT_EMAIL');
|
||||
if (!$to) {
|
||||
fwrite(STDERR, "ALERT_EMAIL not set in .env\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
$from = env('SMTP_FROM', env('SMTP_USER'));
|
||||
$domain = env('DOMAIN', '0012.de');
|
||||
|
||||
$subject = "[{$domain}] SMTP test (local) " . gmdate('Y-m-d H:i:s') . ' UTC';
|
||||
$body = implode("\n", [
|
||||
'0012.de SMTP test — sent from local machine',
|
||||
'',
|
||||
'From header: ' . $from,
|
||||
'SMTP auth: ' . env('SMTP_USER'),
|
||||
'',
|
||||
'If you receive this, local SMTP settings work.',
|
||||
]);
|
||||
|
||||
try {
|
||||
sendMail($to, $subject, $body);
|
||||
echo "Sent test mail to {$to} (From: {$from})\n";
|
||||
} catch (Throwable $e) {
|
||||
fwrite(STDERR, 'Failed: ' . $e->getMessage() . "\n");
|
||||
exit(1);
|
||||
}
|
||||
Reference in New Issue
Block a user