xref: /webtrees/resources/views/admin/site-mail.phtml (revision 4d99955e5797e1e12688b8d0592d207a63b2c6c6)
1<?php use Fisharebest\Webtrees\I18N; ?>
2<?php use Fisharebest\Webtrees\Site; ?>
3<?php use Fisharebest\Webtrees\View; ?>
4
5<?= view('components/breadcrumbs', ['links' => [route('admin-control-panel') => I18N::translate('Control panel'), $title]]) ?>
6
7<h1><?= $title ?></h1>
8
9<p class="alert alert-info">
10    <?= 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>' ?>
11</p>
12
13<form method="post" class="form-horizontal">
14    <?= csrf_field() ?>
15
16    <div class="row form-group">
17        <label for="SMTP_ACTIVE" class="col-sm-3 col-form-label">
18            <?= /* I18N: A configuration setting */ I18N::translate('Messages') ?>
19        </label>
20        <div class="col-sm-9">
21            <?= view('components/select', ['name' => 'SMTP_ACTIVE', 'selected' => Site::getPreference('SMTP_ACTIVE'), 'options' => $mail_transport_options]) ?>
22            <p class="small text-muted">
23                <?= /* 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.') ?>
24            </p>
25        </div>
26    </div>
27
28    <div class="row form-group">
29        <label for="SMTP_FROM_NAME" class="col-sm-3 col-form-label">
30            <?= /* I18N: A configuration setting */ I18N::translate('Sender name') ?>
31        </label>
32        <div class="col-sm-9">
33            <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">
34            <p class="small text-muted">
35                <?= /* 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.') ?>
36            </p>
37        </div>
38    </div>
39
40    <h2><?= I18N::translate('SMTP mail server') ?></h2>
41
42    <div class="row form-group">
43        <label for="SMTP_HOST" class="col-sm-3 col-form-label">
44            <?= /* I18N: A configuration setting */ I18N::translate('Server name') ?>
45        </label>
46        <div class="col-sm-9">
47            <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-]+)*">
48            <p class="small text-muted">
49                <?= /* 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.') ?>
50            </p>
51        </div>
52    </div>
53
54    <div class="row form-group">
55        <label for="SMTP_PORT" class="col-sm-3 col-form-label">
56            <?= /* I18N: A configuration setting */ I18N::translate('Port number') ?>
57        </label>
58        <div class="col-sm-9">
59            <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">
60            <p class="small text-muted">
61                <?= /* I18N: Help text for the "Port number" site configuration setting */ I18N::translate('By default, SMTP works on port 25.') ?>
62            </p>
63        </div>
64    </div>
65
66    <fieldset class="form-group">
67        <div class="row">
68            <legend class="col-form-label col-sm-3">
69                <?= /* I18N: A configuration setting */ I18N::translate('Use password') ?>
70            </legend>
71            <div class="col-sm-9">
72                <?= view('components/radios-inline', ['name' => 'SMTP_AUTH', 'options' => [I18N::translate('no'), I18N::translate('yes')], 'selected' => (int) Site::getPreference('SMTP_AUTH')]) ?>
73                <p class="small text-muted">
74                    <?= /* I18N: Help text for the “Use password” site configuration setting */ I18N::translate('Most SMTP servers require a password.') ?>
75                </p>
76            </div>
77        </div>
78    </fieldset>
79
80    <div class="row form-group">
81        <label for="SMTP_AUTH_USER" class="col-sm-3 col-form-label">
82            <?= /* I18N: A configuration setting */ I18N::translate('Username') ?>
83        </label>
84        <div class="col-sm-9">
85            <input type="text" class="form-control" id="SMTP_AUTH_USER" name="SMTP_AUTH_USER" value="<?= e(Site::getPreference('SMTP_AUTH_USER')) ?>" maxlength="255">
86            <p class="small text-muted">
87                <?= /* I18N: Help text for the "Username" site configuration setting */ I18N::translate('The username required for authentication with the SMTP server.') ?>
88            </p>
89        </div>
90    </div>
91
92    <div class="row form-group">
93        <label for="SMTP_AUTH_PASS" class="col-sm-3 col-form-label">
94            <?= /* I18N: A configuration setting */ I18N::translate('Password') ?>
95        </label>
96        <div class="col-sm-9">
97            <input type="password" class="form-control" id="SMTP_AUTH_PASS" name="SMTP_AUTH_PASS" value="" autocomplete="off">
98            <p class="small text-muted">
99                <?= /* I18N: Help text for the "Password" site configuration setting */ I18N::translate('The password required for authentication with the SMTP server.') ?>
100            </p>
101        </div>
102    </div>
103
104    <div class="row form-group">
105        <label for="SMTP_SSL" class="col-sm-3 col-form-label">
106            <?= /* I18N: A configuration setting */ I18N::translate('Secure connection') ?>
107        </label>
108        <div class="col-sm-9">
109            <?= view('components/select', ['name' => 'SMTP_SSL', 'selected' => Site::getPreference('SMTP_SSL'), 'options' => $mail_ssl_options]) ?>
110            <p class="small text-muted">
111                <?= /* I18N: Help text for the “Secure connection” site configuration setting */ I18N::translate('Most servers do not use secure connections.') ?>
112            </p>
113        </div>
114    </div>
115
116    <div class="row form-group">
117        <label for="SMTP_HELO" class="col-sm-3 col-form-label">
118            <?= /* I18N: A configuration setting */ I18N::translate('Sending server name') ?>
119        </label>
120        <div class="col-sm-9">
121            <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-]+)*">
122            <p class="small text-muted">
123                <?= /* 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.') ?>
124            </p>
125        </div>
126    </div>
127
128    <h2>
129        <?= /* I18N: https://en.wikipedia.org/wiki/DomainKeys_Identified_Mail */ I18N::translate('DKIM digital signature') ?>
130    </h2>
131
132    <div class="row form-group">
133        <label for="DKIM_DOMAIN" class="col-sm-3 col-form-label">
134            <?= I18N::translate('Domain name') ?>
135        </label>
136        <div class="col-sm-9">
137            <input type="text" class="form-control" id="DKIM_DOMAIN" name="DKIM_DOMAIN" value="<?= e(Site::getPreference('DKIM_DOMAIN')) ?>" maxlength="255">
138        </div>
139    </div>
140
141    <div class="row form-group">
142        <label for="DKIM_SELECTOR" class="col-sm-3 col-form-label">
143            <?= I18N::translate('Selector') ?>
144        </label>
145        <div class="col-sm-9">
146            <input type="text" class="form-control" id="DKIM_SELECTOR" name="DKIM_SELECTOR" value="<?= e(Site::getPreference('DKIM_SELECTOR')) ?>" maxlength="255">
147        </div>
148    </div>
149
150    <div class="row form-group">
151        <label for="DKIM_KEY" class="col-sm-3 col-form-label">
152            <?= I18N::translate('Private key') ?>
153        </label>
154        <div class="col-sm-9">
155            <textarea class="form-control" id="DKIM_KEY" name="DKIM_KEY"><?= e(Site::getPreference('DKIM_KEY')) ?></textarea>
156        </div>
157    </div>
158
159    <div class="row form-group">
160        <div class="offset-sm-3 col-sm-9">
161            <button type="submit" class="btn btn-primary">
162                <?= view('icons/save') ?>
163                <?= I18N::translate('save') ?>
164            </button>
165
166            <a href="<?= e(route('admin-control-panel')) ?>" class="btn btn-secondary">
167                <?= view('icons/cancel') ?>
168                <?= I18N::translate('cancel') ?>
169            </a>
170        </div>
171    </div>
172</form>
173
174<?php View::push('javascript') ?>
175<script>
176    $('#SMTP_AUTH_PASS').hideShowPassword('infer', true);
177</script>
178<?php View::endpush() ?>
179