['label' => 'Servidor SMTP', 'type' => 'text', 'hint' => 'Vazio = usa a função mail() do PHP.'], 'smtp_port' => ['label' => 'Porta', 'type' => 'number', 'hint' => '587 para TLS, 465 para SSL.'], 'smtp_secure' => ['label' => 'Encriptação', 'type' => 'select', 'options' => ['tls' => 'TLS (StartTLS)', 'ssl' => 'SSL', '' => 'Nenhuma']], 'smtp_username' => ['label' => 'Utilizador', 'type' => 'text', 'hint' => 'Normalmente o endereço de email completo.'], 'smtp_password' => ['label' => 'Palavra-passe', 'type' => 'password'], 'email_from' => ['label' => 'Remetente', 'type' => 'text', 'hint' => 'Endereço que aparece no From.'], 'email_from_name' => ['label' => 'Nome do remetente', 'type' => 'text'], 'twilio_sid' => ['label' => 'Account SID', 'type' => 'text', 'hint' => 'Começa por AC…'], 'twilio_token' => ['label' => 'Auth Token', 'type' => 'password'], 'twilio_sms_from' => ['label' => 'Remetente SMS', 'type' => 'text', 'hint' => 'E.164 (+351…) ou alfanumérico.'], 'twilio_whatsapp_from' => ['label' => 'Remetente WhatsApp', 'type' => 'text', 'hint' => 'Número E.164, sem o prefixo whatsapp:.'], 'sms_default_country_code' => ['label' => 'Indicativo por defeito', 'type' => 'text', 'hint' => 'Aplicado a números guardados sem +.'], ]; $groups = [ 'SMTP' => ['smtp_host', 'smtp_port', 'smtp_secure', 'smtp_username', 'smtp_password', 'email_from', 'email_from_name'], 'Twilio (SMS / WhatsApp)' => ['twilio_sid', 'twilio_token', 'twilio_sms_from', 'twilio_whatsapp_from', 'sms_default_country_code'], ]; if ($_SERVER['REQUEST_METHOD'] === 'POST') { csrf_check(); $action = $_POST['_action'] ?? 'save'; $uid = (int) $user['id']; if ($action === 'save') { foreach ($fields as $key => $meta) { $raw = trim((string) ($_POST[$key] ?? '')); if (platform_settings_is_secret($key)) { // Blank means "leave the stored one alone" — the field is never // pre-filled with the real value, so blank cannot mean "clear". // Clearing is an explicit checkbox. if (!empty($_POST[$key . '_clear'])) { db_update_setting($pdo, $key, '', $uid); } elseif ($raw !== '') { db_update_setting($pdo, $key, secret_encrypt($raw), $uid); } continue; } db_update_setting($pdo, $key, $raw, $uid); } // db_update_setting() drops fitme3070's file cache; platform_settings_get() // keeps its own per-request cache, which must go too or the diagnostics // below would render the values from before this save. platform_settings_cache_clear(); $saved = true; } elseif ($action === 'test') { $test = platform_mail_test($repo_root, platform_smtp_config($pdo)); } } $current = settings_all(); [$diagClass, $diagTitle, $diagText] = platform_mail_diagnosis($repo_root, null, $pdo); $rows = platform_mail_config_rows(null, $pdo); $page_title = 'Comunicações'; include __DIR__ . '/../../includes/header.php'; ?>

Comunicações

Credenciais de envio e diagnóstico. As palavras-passe são guardadas cifradas.

Definições guardadas.
Cifra indisponível. Defina APP_SECRET_KEY no .env (ou um BACKUP_TOKEN que não seja replace_me) — sem chave, as palavras-passe ficam guardadas em texto simples e acabam nos backups da base de dados.

Estado


Registo da ligação

Valores pinados no .env têm precedência sobre estes campos — se editar aqui e nada mudar, é porque a chave está definida no .env.

$keys): ?>

Ver fila de mensagens →