summaryrefslogtreecommitdiff
path: root/resources/views/admin/site-mail.phtml
blob: 9b733dd86323f6872930aee8daa2eaa4e819ae48 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
<?php

declare(strict_types=1);

use Fisharebest\Webtrees\Http\RequestHandlers\ControlPanel;
use Fisharebest\Webtrees\Http\RequestHandlers\EmailPreferencesAction;
use Fisharebest\Webtrees\I18N;
use Fisharebest\Webtrees\Webtrees;

/**
 * @var string        $DKIM_DOMAIN
 * @var string        $DKIM_KEY
 * @var string        $DKIM_SELECTOR
 * @var string        $SMTP_ACTIVE
 * @var string        $SMTP_AUTH
 * @var string        $SMTP_AUTH_USER
 * @var string        $SMTP_DISP_NAME
 * @var string        $SMTP_FROM_NAME
 * @var string        $SMTP_HELO
 * @var string        $SMTP_HOST
 * @var string        $SMTP_PORT
 * @var string        $SMTP_SSL
 * @var array<string> $mail_ssl_options
 * @var array<string> $mail_transport_options
 * @var bool          $smtp_helo_valid
 * @var bool          $smtp_from_name_valid
 * @var string        $title
 */
?>

<?= view('components/breadcrumbs', ['links' => [route(ControlPanel::class) => I18N::translate('Control panel'), $title]]) ?>

<h1><?= $title ?></h1>

<div class="alert alert-info">
    <?= I18N::translate('See %s for more information.', '<a class="alert-link" href="' . e(Webtrees::URL_FAQ_EMAIL) . '">' . e(Webtrees::URL_FAQ_EMAIL) . '</a>') ?>
</div>

<form method="post" action="<?= e(route(EmailPreferencesAction::class)) ?>" class="form-horizontal">
    <div class="row mb-3">
        <label for="SMTP_ACTIVE" class="col-sm-3 col-form-label">
            <?= /* I18N: A configuration setting */
            I18N::translate('Messages') ?>
        </label>
        <div class="col-sm-9">
            <?= view('components/select', ['name' => 'SMTP_ACTIVE', 'selected' => $SMTP_ACTIVE, 'options' => $mail_transport_options]) ?>
            <div class="form-text">
                <?= /* I18N: Help text for the “Messages” site configuration setting */
                I18N::translate('webtrees needs to send emails, such as password reminders and website notifications.') ?>
            </div>
        </div>
    </div>

    <div class="row mb-3">
        <label for="SMTP_DISP_NAME" class="col-sm-3 col-form-label">
            <?= /* I18N: A configuration setting */
            I18N::translate('Sender name') ?>
        </label>
        <div class="col-sm-9">
            <input type="text" class="form-control" id="SMTP_DISP_NAME" name="SMTP_DISP_NAME" value="<?= e($SMTP_DISP_NAME) ?>" maxlength="255" required="required">
            <div class="form-text">
                <?= /* 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.') ?>
            </div>
        </div>
    </div>

    <div class="row mb-3">
        <label for="SMTP_FROM_NAME" class="col-sm-3 col-form-label">
            <?= /* I18N: A configuration setting */
            I18N::translate('Sender email') ?>
        </label>
        <div class="col-sm-9">
            <input type="email" class="form-control" id="SMTP_FROM_NAME" name="SMTP_FROM_NAME" value="<?= e($SMTP_FROM_NAME) ?>" maxlength="255" required="required">
            <div class="form-text">
                <?= /* 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.') ?>
            </div>

            <?php if (!$smtp_from_name_valid) : ?>
                <p class="alert alert-warning">
                    <?= I18N::translate('Most mail servers require a valid email address.') ?>
                </p>
            <?php endif ?>
        </div>
    </div>

    <h2><?= I18N::translate('SMTP mail server') ?></h2>

    <div class="row mb-3">
        <label for="SMTP_HOST" class="col-sm-3 col-form-label">
            <?= /* I18N: A configuration setting */
            I18N::translate('Server name') ?>
        </label>
        <div class="col-sm-9">
            <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-]+)*">
            <div class="form-text">
                <?= /* 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.') ?>
            </div>
        </div>
    </div>

    <div class="row mb-3">
        <label for="SMTP_PORT" class="col-sm-3 col-form-label">
            <?= /* I18N: A configuration setting */
            I18N::translate('Port number') ?>
        </label>
        <div class="col-sm-9">
            <input type="text" class="form-control" id="SMTP_PORT" name="SMTP_PORT" value="<?= e($SMTP_PORT) ?>" pattern="[0-9]*" placeholder="25" maxlength="5">
            <div class="form-text">
                <?= /* I18N: Help text for the "Port number" site configuration setting */
                I18N::translate('By default, SMTP works on port 25.') ?>
            </div>
        </div>
    </div>

    <fieldset class="row mb-3">
        <legend class="col-form-label col-sm-3">
            <?= /* I18N: A configuration setting */
            I18N::translate('Use password') ?>
        </legend>
        <div class="col-sm-9">
            <?= view('components/radios-inline', ['name' => 'SMTP_AUTH', 'options' => [I18N::translate('no'), I18N::translate('yes')], 'selected' => (int) $SMTP_AUTH]) ?>
            <div class="form-text">
                <?= /* I18N: Help text for the “Use password” site configuration setting */
                I18N::translate('Most SMTP servers require a password.') ?>
            </div>
        </div>
    </fieldset>

    <div class="row mb-3">
        <label for="SMTP_AUTH_USER" class="col-sm-3 col-form-label">
            <?= /* I18N: A configuration setting */
            I18N::translate('Username') ?>
        </label>
        <div class="col-sm-9">
            <input type="text" class="form-control" id="SMTP_AUTH_USER" name="SMTP_AUTH_USER" value="<?= e($SMTP_AUTH_USER) ?>" maxlength="255">
            <div class="form-text">
                <?= /* I18N: Help text for the "Username" site configuration setting */
                I18N::translate('The username required for authentication with the SMTP server.') ?>
            </div>
        </div>
    </div>

    <div class="row mb-3">
        <label for="SMTP_AUTH_PASS" class="col-sm-3 col-form-label">
            <?= /* I18N: A configuration setting */
            I18N::translate('Password') ?>
        </label>
        <div class="col-sm-9">
            <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')) ?>">
            <div class="form-text">
                <?= /* I18N: Help text for the "Password" site configuration setting */
                I18N::translate('The password required for authentication with the SMTP server.') ?>
            </div>
        </div>
    </div>

    <div class="row mb-3">
        <label for="SMTP_SSL" class="col-sm-3 col-form-label">
            <?= /* I18N: A configuration setting */
            I18N::translate('Secure connection') ?>
        </label>
        <div class="col-sm-9">
            <?= view('components/select', ['name' => 'SMTP_SSL', 'selected' => $SMTP_SSL, 'options' => $mail_ssl_options]) ?>
            <div class="form-text">
                <?= /* I18N: Help text for the “Secure connection” site configuration setting */
                I18N::translate('Most servers do not use secure connections.') ?>
            </div>
        </div>
    </div>

    <div class="row mb-3">
        <label for="SMTP_HELO" class="col-sm-3 col-form-label">
            <?= /* I18N: A configuration setting */
            I18N::translate('Sending server name') ?>
        </label>
        <div class="col-sm-9">
            <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-]+)*">
            <div class="form-text">
                <?= /* I18N: Help text for the "Sending server name" site configuration setting */
                I18N::translate('Most mail servers require that the sending server identifies itself correctly, using a valid domain name.') ?>
            </div>

            <?php if (!$smtp_helo_valid) : ?>
                <p class="alert alert-warning">
                    <?= I18N::translate('Most mail servers require a valid domain name.') ?>
                </p>
            <?php endif ?>
        </div>
    </div>

    <h2>
        <?= /* I18N: https://en.wikipedia.org/wiki/DomainKeys_Identified_Mail */
        I18N::translate('DKIM digital signature') ?>
    </h2>

    <div class="row mb-3">
        <label for="DKIM_DOMAIN" class="col-sm-3 col-form-label">
            <?= I18N::translate('Domain name') ?>
        </label>
        <div class="col-sm-9">
            <input type="text" class="form-control" id="DKIM_DOMAIN" name="DKIM_DOMAIN" value="<?= e($DKIM_DOMAIN) ?>" maxlength="255">
        </div>
    </div>

    <div class="row mb-3">
        <label for="DKIM_SELECTOR" class="col-sm-3 col-form-label">
            <?= I18N::translate('Selector') ?>
        </label>
        <div class="col-sm-9">
            <input type="text" class="form-control" id="DKIM_SELECTOR" name="DKIM_SELECTOR" value="<?= e($DKIM_SELECTOR) ?>" maxlength="255">
        </div>
    </div>

    <div class="row mb-3">
        <label for="DKIM_KEY" class="col-sm-3 col-form-label">
            <?= I18N::translate('Private key') ?>
        </label>
        <div class="col-sm-9">
            <textarea class="form-control" id="DKIM_KEY" name="DKIM_KEY"><?= e($DKIM_KEY) ?></textarea>
        </div>
    </div>

    <hr>

    <div class="row mb-3">
        <div class="offset-sm-3 col-sm-9">
            <p class="form-check">
                <input class="form-check-input" type="checkbox" id="test" name="test">
                <label class="form-check-label" for="test">
                    <?= I18N::translate('Send a test email using these settings') ?>
                </label>
            </p>

            <button type="submit" class="btn btn-primary">
                <?= view('icons/save') ?>
                <?= I18N::translate('save') ?>
            </button>

            <a href="<?= e(route(ControlPanel::class)) ?>" class="btn btn-secondary">
                <?= view('icons/cancel') ?>
                <?= I18N::translate('cancel') ?>
            </a>
        </div>
    </div>

    <?= csrf_field() ?>
</form>