示例#1
0
<?php

include "_config.php";
use Symfony\Component\Yaml\Yaml;
$config = new \App\Configuration\Email();
if (is_file("/data/smtp.yml")) {
    $config->loadConfig(Yaml::parse(file_get_contents('/data/smtp.yml')));
}
if (!empty($_POST)) {
    $config->loadConfig($_POST);
    file_put_contents('/data/smtp.yml', Yaml::dump($config->export()));
    $em = new \App\EmailAlertHandler($config);
    try {
        $em->sendTestMessage();
        $message = "Changes saved, test message was sent to {$_POST['alertEmailTarget']}!";
    } catch (\Exception $e) {
        $error = $e->getMessage();
    }
}
$title = "Email alerts";
include "_header.php";
?>

    <div class="head">
        <h1><?php 
echo $title;
?>
</h1>
        <p><a href="index">&larr; Back to the certificates list</a></p>
    </div>