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