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