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