1<?php use Fisharebest\Webtrees\Bootstrap4; ?> 2<?php use Fisharebest\Webtrees\Functions\FunctionsEdit; ?> 3<?php use Fisharebest\Webtrees\I18N; ?> 4<?php use Fisharebest\Webtrees\Site; ?> 5<?php use Fisharebest\Webtrees\View; ?> 6 7<?= view('components/breadcrumbs', ['links' => [route('admin-control-panel') => I18N::translate('Control panel'), $title]]) ?> 8 9<h1><?= $title ?></h1> 10 11<p class="alert alert-info"> 12 <?= I18N::translate('To use a Google mail account, use the following settings: server=smtp.gmail.com, port=587, security=tls, username=xxxxx@gmail.com, password=[your gmail password]') . '<br>' . I18N::translate('You must also enable “less secure applications” in your Google account.') . ' <a href="https://www.google.com/settings/security/lesssecureapps">https://www.google.com/settings/security/lesssecureapps</a>' ?> 13</p> 14 15<form method="post" class="form-horizontal"> 16 <?= csrf_field() ?> 17 18 <!-- SMTP_ACTIVE --> 19 <div class="row form-group"> 20 <label for="SMTP_ACTIVE" class="col-sm-3 col-form-label"> 21 <?= /* I18N: A configuration setting */ I18N::translate('Messages') ?> 22 </label> 23 <div class="col-sm-9"> 24 <?= Bootstrap4::select($mail_transport_options, Site::getPreference('SMTP_ACTIVE'), ['id' => 'SMTP_ACTIVE', 'name' => 'SMTP_ACTIVE']) ?> 25 <p class="small text-muted"> 26 <?= /* I18N: Help text for the “Messages” site configuration setting */ I18N::translate('webtrees needs to send emails, such as password reminders and website notifications. To do this, it can use this server’s built in PHP mail facility (which is not always available) or an external SMTP (mail-relay) service, for which you will need to provide the connection details.') ?> 27 </p> 28 </div> 29 </div> 30 31 <!-- SMTP_FROM_NAME --> 32 <div class="row form-group"> 33 <label for="SMTP_FROM_NAME" class="col-sm-3 col-form-label"> 34 <?= /* I18N: A configuration setting */ I18N::translate('Sender name') ?> 35 </label> 36 <div class="col-sm-9"> 37 <input type="email" class="form-control" id="SMTP_FROM_NAME" name="SMTP_FROM_NAME" value="<?= e(Site::getPreference('SMTP_FROM_NAME')) ?>" placeholder="no-reply@localhost" maxlength="255"> 38 <p class="small text-muted"> 39 <?= /* I18N: Help text for the “Sender name” site configuration setting */ I18N::translate('This name is used in the “From” field, when sending automatic emails from this server.') ?> 40 </p> 41 </div> 42 </div> 43 44 <h2><?= I18N::translate('SMTP mail server') ?></h2> 45 46 <!-- SMTP_HOST --> 47 <div class="row form-group"> 48 <label for="SMTP_HOST" class="col-sm-3 col-form-label"> 49 <?= /* I18N: A configuration setting */ I18N::translate('Server name') ?> 50 </label> 51 <div class="col-sm-9"> 52 <input type="text" class="form-control" id="SMTP_HOST" name="SMTP_HOST" value="<?= e(Site::getPreference('SMTP_HOST')) ?>" placeholder="smtp.example.com" maxlength="255" pattern="[a-z0-9-]+(\.[a-z0-9-]+)*"> 53 <p class="small text-muted"> 54 <?= /* I18N: Help text for the “Server name” site configuration setting */ 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.') ?> 55 </p> 56 </div> 57 </div> 58 59 <!-- SMTP_PORT --> 60 <div class="row form-group"> 61 <label for="SMTP_PORT" class="col-sm-3 col-form-label"> 62 <?= /* I18N: A configuration setting */ I18N::translate('Port number') ?> 63 </label> 64 <div class="col-sm-9"> 65 <input type="text" class="form-control" id="SMTP_PORT" name="SMTP_PORT" value="<?= e(Site::getPreference('SMTP_PORT')) ?>" pattern="[0-9]*" placeholder="25" maxlength="5"> 66 <p class="small text-muted"> 67 <?= /* I18N: Help text for the "Port number" site configuration setting */ I18N::translate('By default, SMTP works on port 25.') ?> 68 </p> 69 </div> 70 </div> 71 72 <!-- SMTP_AUTH --> 73 <fieldset class="form-group"> 74 <div class="row"> 75 <legend class="col-form-label col-sm-3"> 76 <?= /* I18N: A configuration setting */ I18N::translate('Use password') ?> 77 </legend> 78 <div class="col-sm-9"> 79 <?= Bootstrap4::radioButtons('SMTP_AUTH', FunctionsEdit::optionsNoYes(), Site::getPreference('SMTP_AUTH'), true) ?> 80 <p class="small text-muted"> 81 <?= /* I18N: Help text for the “Use password” site configuration setting */ I18N::translate('Most SMTP servers require a password.') ?> 82 </p> 83 </div> 84 </div> 85 </fieldset> 86 87 <!-- SMTP_AUTH_USER --> 88 <div class="row form-group"> 89 <label for="SMTP_AUTH_USER" class="col-sm-3 col-form-label"> 90 <?= /* I18N: A configuration setting */ I18N::translate('Username') ?> 91 </label> 92 <div class="col-sm-9"> 93 <input type="text" class="form-control" id="SMTP_AUTH_USER" name="SMTP_AUTH_USER" value="<?= e(Site::getPreference('SMTP_AUTH_USER')) ?>" maxlength="255"> 94 <p class="small text-muted"> 95 <?= /* I18N: Help text for the "Username" site configuration setting */ I18N::translate('The username required for authentication with the SMTP server.') ?> 96 </p> 97 </div> 98 </div> 99 100 <!-- SMTP_AUTH_PASS --> 101 <div class="row form-group"> 102 <label for="SMTP_AUTH_PASS" class="col-sm-3 col-form-label"> 103 <?= /* I18N: A configuration setting */ I18N::translate('Password') ?> 104 </label> 105 <div class="col-sm-9"> 106 <input type="password" class="form-control" id="SMTP_AUTH_PASS" name="SMTP_AUTH_PASS" value=""> 107 <p class="small text-muted"> 108 <?= /* I18N: Help text for the "Password" site configuration setting */ I18N::translate('The password required for authentication with the SMTP server.') ?> 109 </p> 110 </div> 111 </div> 112 113 <!-- SMTP_SSL --> 114 <div class="row form-group"> 115 <label for="SMTP_SSL" class="col-sm-3 col-form-label"> 116 <?= /* I18N: A configuration setting */ I18N::translate('Secure connection') ?> 117 </label> 118 <div class="col-sm-9"> 119 <?= Bootstrap4::select($mail_ssl_options, Site::getPreference('SMTP_SSL'), ['id' => 'SMTP_SSL', 'name' => 'SMTP_SSL']) ?> 120 <p class="small text-muted"> 121 <?= /* I18N: Help text for the “Secure connection” site configuration setting */ I18N::translate('Most servers do not use secure connections.') ?> 122 </p> 123 </div> 124 </div> 125 126 <!-- SMTP_HELO --> 127 <div class="row form-group"> 128 <label for="SMTP_HELO" class="col-sm-3 col-form-label"> 129 <?= /* I18N: A configuration setting */ I18N::translate('Sending server name') ?> 130 </label> 131 <div class="col-sm-9"> 132 <input type="text" class="form-control" id="SMTP_HELO" name="SMTP_HELO" value="<?= e(Site::getPreference('SMTP_HELO')) ?>" placeholder="localhost" maxlength="255" pattern="[a-z0-9-]+(\.[a-z0-9-]+)*"> 133 <p class="small text-muted"> 134 <?= /* I18N: Help text for the "Sending server name" site configuration setting */ I18N::translate('Many mail servers require that the sending server identifies itself correctly, using a valid domain name.') ?> 135 </p> 136 </div> 137 </div> 138 139 <div class="row form-group"> 140 <div class="offset-sm-3 col-sm-9"> 141 <button type="submit" class="btn btn-primary"> 142 <?= view('icons/save') ?> 143 <?= I18N::translate('save') ?> 144 </button> 145 146 <a href="<?= e(route('admin-control-panel')) ?>" class="btn btn-secondary"> 147 <?= view('icons/cancel') ?> 148 <?= I18N::translate('cancel') ?> 149 </a> 150 </div> 151 </div> 152</form> 153 154<?php View::push('javascript') ?> 155<script> 156 $('#SMTP_AUTH_PASS').hideShowPassword('infer', true); 157</script> 158<?php View::endpush() ?> 159