1<?php 2 3use Fisharebest\Webtrees\Http\RequestHandlers\ControlPanel; 4use Fisharebest\Webtrees\Http\RequestHandlers\EmailPreferencesAction; 5use Fisharebest\Webtrees\I18N; 6use Fisharebest\Webtrees\View; 7use Fisharebest\Webtrees\Webtrees; 8 9/** 10 * @var string $DKIM_DOMAIN 11 * @var string $DKIM_KEY 12 * @var string $DKIM_SELECTOR 13 * @var string $SMTP_ACTIVE 14 * @var string $SMTP_AUTH 15 * @var string $SMTP_AUTH_USER 16 * @var string $SMTP_FROM_NAME 17 * @var string $SMTP_HELO 18 * @var string $SMTP_HOST 19 * @var string $SMTP_PORT 20 * @var string $SMTP_SSL 21 * @var string[] $mail_ssl_options 22 * @var string[] $mail_transport_options 23 * @var bool $smtp_helo_valid 24 * @var bool $smtp_from_name_valid 25 * @var string $title 26 */ 27?> 28 29<?= view('components/breadcrumbs', ['links' => [route(ControlPanel::class) => I18N::translate('Control panel'), $title]]) ?> 30 31<h1><?= $title ?></h1> 32 33<div class="alert alert-info"> 34 <?= I18N::translate('See %s for more information.', '<a class="alert-link" href="' . e(Webtrees::URL_FAQ_EMAIL) . '">' . e(Webtrees::URL_FAQ_EMAIL) . '</a>') ?> 35</div> 36 37<form method="post" action="<?= e(route(EmailPreferencesAction::class)) ?>" class="form-horizontal"> 38 <?= csrf_field() ?> 39 40 <div class="row form-group"> 41 <label for="SMTP_ACTIVE" class="col-sm-3 col-form-label"> 42 <?= /* I18N: A configuration setting */ 43 I18N::translate('Messages') ?> 44 </label> 45 <div class="col-sm-9"> 46 <?= view('components/select', ['name' => 'SMTP_ACTIVE', 'selected' => $SMTP_ACTIVE, 'options' => $mail_transport_options]) ?> 47 <p class="small text-muted"> 48 <?= /* I18N: Help text for the “Messages” site configuration setting */ 49 I18N::translate('webtrees needs to send emails, such as password reminders and website notifications.') ?> 50 </p> 51 </div> 52 </div> 53 54 <div class="row form-group"> 55 <label for="SMTP_FROM_NAME" class="col-sm-3 col-form-label"> 56 <?= /* I18N: A configuration setting */ 57 I18N::translate('Sender name') ?> 58 </label> 59 <div class="col-sm-9"> 60 <input type="email" class="form-control" id="SMTP_FROM_NAME" name="SMTP_FROM_NAME" value="<?= e($SMTP_FROM_NAME) ?>" maxlength="255"> 61 <p class="small text-muted"> 62 <?= /* I18N: Help text for the “Sender name” site configuration setting */ 63 I18N::translate('This name is used in the “From” field, when sending automatic emails from this server.') ?> 64 </p> 65 66 <?php if (!$smtp_from_name_valid) : ?> 67 <p class="alert alert-warning"> 68 <?= I18N::translate('Most mail servers require a valid email address.') ?> 69 </p> 70 <?php endif ?> 71 </div> 72 </div> 73 74 <h2><?= I18N::translate('SMTP mail server') ?></h2> 75 76 <div class="row form-group"> 77 <label for="SMTP_HOST" class="col-sm-3 col-form-label"> 78 <?= /* I18N: A configuration setting */ 79 I18N::translate('Server name') ?> 80 </label> 81 <div class="col-sm-9"> 82 <input type="text" class="form-control" id="SMTP_HOST" name="SMTP_HOST" value="<?= e($SMTP_HOST) ?>" placeholder="smtp.example.com" maxlength="255" pattern="[a-z0-9-]+(\.[a-z0-9-]+)*"> 83 <p class="small text-muted"> 84 <?= /* I18N: Help text for the “Server name” site configuration setting */ 85 I18N::translate('This is the name of the SMTP server. “localhost” means that the mail service is running on the same computer as your web server.') ?> 86 </p> 87 </div> 88 </div> 89 90 <div class="row form-group"> 91 <label for="SMTP_PORT" class="col-sm-3 col-form-label"> 92 <?= /* I18N: A configuration setting */ 93 I18N::translate('Port number') ?> 94 </label> 95 <div class="col-sm-9"> 96 <input type="text" class="form-control" id="SMTP_PORT" name="SMTP_PORT" value="<?= e($SMTP_PORT) ?>" pattern="[0-9]*" placeholder="25" maxlength="5"> 97 <p class="small text-muted"> 98 <?= /* I18N: Help text for the "Port number" site configuration setting */ 99 I18N::translate('By default, SMTP works on port 25.') ?> 100 </p> 101 </div> 102 </div> 103 104 <fieldset class="form-group"> 105 <div class="row"> 106 <legend class="col-form-label col-sm-3"> 107 <?= /* I18N: A configuration setting */ 108 I18N::translate('Use password') ?> 109 </legend> 110 <div class="col-sm-9"> 111 <?= view('components/radios-inline', ['name' => 'SMTP_AUTH', 'options' => [I18N::translate('no'), I18N::translate('yes')], 'selected' => (int) $SMTP_AUTH]) ?> 112 <p class="small text-muted"> 113 <?= /* I18N: Help text for the “Use password” site configuration setting */ 114 I18N::translate('Most SMTP servers require a password.') ?> 115 </p> 116 </div> 117 </div> 118 </fieldset> 119 120 <div class="row form-group"> 121 <label for="SMTP_AUTH_USER" class="col-sm-3 col-form-label"> 122 <?= /* I18N: A configuration setting */ 123 I18N::translate('Username') ?> 124 </label> 125 <div class="col-sm-9"> 126 <input type="text" class="form-control" id="SMTP_AUTH_USER" name="SMTP_AUTH_USER" value="<?= e($SMTP_AUTH_USER) ?>" maxlength="255"> 127 <p class="small text-muted"> 128 <?= /* I18N: Help text for the "Username" site configuration setting */ 129 I18N::translate('The username required for authentication with the SMTP server.') ?> 130 </p> 131 </div> 132 </div> 133 134 <div class="row form-group"> 135 <label for="SMTP_AUTH_PASS" class="col-sm-3 col-form-label"> 136 <?= /* I18N: A configuration setting */ 137 I18N::translate('Password') ?> 138 </label> 139 <div class="col-sm-9"> 140 <input type="password" class="form-control" id="SMTP_AUTH_PASS" name="SMTP_AUTH_PASS" value="" autocomplete="new-password"> 141 <p class="small text-muted"> 142 <?= /* I18N: Help text for the "Password" site configuration setting */ 143 I18N::translate('The password required for authentication with the SMTP server.') ?> 144 </p> 145 </div> 146 </div> 147 148 <div class="row form-group"> 149 <label for="SMTP_SSL" class="col-sm-3 col-form-label"> 150 <?= /* I18N: A configuration setting */ 151 I18N::translate('Secure connection') ?> 152 </label> 153 <div class="col-sm-9"> 154 <?= view('components/select', ['name' => 'SMTP_SSL', 'selected' => $SMTP_SSL, 'options' => $mail_ssl_options]) ?> 155 <p class="small text-muted"> 156 <?= /* I18N: Help text for the “Secure connection” site configuration setting */ 157 I18N::translate('Most servers do not use secure connections.') ?> 158 </p> 159 </div> 160 </div> 161 162 <div class="row form-group"> 163 <label for="SMTP_HELO" class="col-sm-3 col-form-label"> 164 <?= /* I18N: A configuration setting */ 165 I18N::translate('Sending server name') ?> 166 </label> 167 <div class="col-sm-9"> 168 <input type="text" class="form-control" id="SMTP_HELO" name="SMTP_HELO" value="<?= e($SMTP_HELO) ?>" maxlength="255" pattern="[a-z0-9-]+(\.[a-z0-9-]+)*"> 169 <p class="small text-muted"> 170 <?= /* I18N: Help text for the "Sending server name" site configuration setting */ 171 I18N::translate('Most mail servers require that the sending server identifies itself correctly, using a valid domain name.') ?> 172 </p> 173 174 <?php if (!$smtp_helo_valid) : ?> 175 <p class="alert alert-warning"> 176 <?= I18N::translate('Most mail servers require a valid domain name.') ?> 177 </p> 178 <?php endif ?> 179 </div> 180 </div> 181 182 <h2> 183 <?= /* I18N: https://en.wikipedia.org/wiki/DomainKeys_Identified_Mail */ 184 I18N::translate('DKIM digital signature') ?> 185 </h2> 186 187 <div class="row form-group"> 188 <label for="DKIM_DOMAIN" class="col-sm-3 col-form-label"> 189 <?= I18N::translate('Domain name') ?> 190 </label> 191 <div class="col-sm-9"> 192 <input type="text" class="form-control" id="DKIM_DOMAIN" name="DKIM_DOMAIN" value="<?= e($DKIM_DOMAIN) ?>" maxlength="255"> 193 </div> 194 </div> 195 196 <div class="row form-group"> 197 <label for="DKIM_SELECTOR" class="col-sm-3 col-form-label"> 198 <?= I18N::translate('Selector') ?> 199 </label> 200 <div class="col-sm-9"> 201 <input type="text" class="form-control" id="DKIM_SELECTOR" name="DKIM_SELECTOR" value="<?= e($DKIM_SELECTOR) ?>" maxlength="255"> 202 </div> 203 </div> 204 205 <div class="row form-group"> 206 <label for="DKIM_KEY" class="col-sm-3 col-form-label"> 207 <?= I18N::translate('Private key') ?> 208 </label> 209 <div class="col-sm-9"> 210 <textarea class="form-control" id="DKIM_KEY" name="DKIM_KEY"><?= e($DKIM_KEY) ?></textarea> 211 </div> 212 </div> 213 214 <hr> 215 216 <div class="row form-group"> 217 <div class="offset-sm-3 col-sm-9"> 218 <p class="form-check"> 219 <input class="form-check-input" type="checkbox" id="test" name="test"> 220 <label class="form-check-label" for="test"> 221 <?= I18N::translate('Send a test email using these settings') ?> 222 </label> 223 </p> 224 225 <button type="submit" class="btn btn-primary"> 226 <?= view('icons/save') ?> 227 <?= I18N::translate('save') ?> 228 </button> 229 230 <a href="<?= e(route(ControlPanel::class)) ?>" class="btn btn-secondary"> 231 <?= view('icons/cancel') ?> 232 <?= I18N::translate('cancel') ?> 233 </a> 234 </div> 235 </div> 236</form> 237 238<?php View::push('javascript') ?> 239<script> 240 $("#SMTP_AUTH_PASS").hideShowPassword("infer", true); 241</script> 242<?php View::endpush() ?> 243