xref: /webtrees/resources/views/admin/site-mail.phtml (revision 8121b9bec19818120092699199161a1357bb8f3f)
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
6<?= view('components/breadcrumbs', ['links' => [route('admin-control-panel') => I18N::translate('Control panel'), $title]]) ?>
7
8<h1><?= $title ?></h1>
9
10<p class="alert alert-info">
11    <?= 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>' ?>
12</p>
13
14<form method="post" class="form-horizontal">
15    <?= csrf_field() ?>
16
17    <!-- SMTP_ACTIVE -->
18    <div class="row form-group">
19        <label for="SMTP_ACTIVE" class="col-sm-3 col-form-label">
20            <?= /* I18N: A configuration setting */ I18N::translate('Messages') ?>
21        </label>
22        <div class="col-sm-9">
23            <?= Bootstrap4::select($mail_transport_options, Site::getPreference('SMTP_ACTIVE'), ['id' => 'SMTP_ACTIVE', 'name' => 'SMTP_ACTIVE']) ?>
24            <p class="small text-muted">
25                <?= /* 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.') ?>
26            </p>
27        </div>
28    </div>
29
30    <!-- SMTP_FROM_NAME -->
31    <div class="row form-group">
32        <label for="SMTP_FROM_NAME" class="col-sm-3 col-form-label">
33            <?= /* I18N: A configuration setting */ I18N::translate('Sender name') ?>
34        </label>
35        <div class="col-sm-9">
36            <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">
37            <p class="small text-muted">
38                <?= /* 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.') ?>
39            </p>
40        </div>
41    </div>
42
43    <h2><?= I18N::translate('SMTP mail server') ?></h2>
44
45    <!-- SMTP_HOST -->
46    <div class="row form-group">
47        <label for="SMTP_HOST" class="col-sm-3 col-form-label">
48            <?= /* I18N: A configuration setting */ I18N::translate('Server name') ?>
49        </label>
50        <div class="col-sm-9">
51            <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-]+)*">
52            <p class="small text-muted">
53                <?= /* 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.') ?>
54            </p>
55        </div>
56    </div>
57
58    <!-- SMTP_PORT -->
59    <div class="row form-group">
60        <label for="SMTP_PORT" class="col-sm-3 col-form-label">
61            <?= /* I18N: A configuration setting */ I18N::translate('Port number') ?>
62        </label>
63        <div class="col-sm-9">
64            <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">
65            <p class="small text-muted">
66                <?= /* I18N: Help text for the "Port number" site configuration setting */ I18N::translate('By default, SMTP works on port 25.') ?>
67            </p>
68        </div>
69    </div>
70
71    <!-- SMTP_AUTH -->
72    <fieldset class="form-group">
73        <div class="row">
74            <legend class="col-form-label col-sm-3">
75                <?= /* I18N: A configuration setting */ I18N::translate('Use password') ?>
76            </legend>
77            <div class="col-sm-9">
78                <?= Bootstrap4::radioButtons('SMTP_AUTH', FunctionsEdit::optionsNoYes(), Site::getPreference('SMTP_AUTH'), true) ?>
79                <p class="small text-muted">
80                    <?= /* I18N: Help text for the “Use password” site configuration setting */ I18N::translate('Most SMTP servers require a password.') ?>
81                </p>
82            </div>
83        </div>
84    </fieldset>
85
86    <!-- SMTP_AUTH_USER -->
87    <div class="row form-group">
88        <label for="SMTP_AUTH_USER" class="col-sm-3 col-form-label">
89            <?= /* I18N: A configuration setting */ I18N::translate('Username') ?>
90        </label>
91        <div class="col-sm-9">
92            <input type="text" class="form-control" id="SMTP_AUTH_USER" name="SMTP_AUTH_USER" value="<?= e(Site::getPreference('SMTP_AUTH_USER')) ?>" maxlength="255">
93            <p class="small text-muted">
94                <?= /* I18N: Help text for the "Username" site configuration setting */ I18N::translate('The username required for authentication with the SMTP server.') ?>
95            </p>
96        </div>
97    </div>
98
99    <!-- SMTP_AUTH_PASS -->
100    <div class="row form-group">
101        <label for="SMTP_AUTH_PASS" class="col-sm-3 col-form-label">
102            <?= /* I18N: A configuration setting */ I18N::translate('Password') ?>
103        </label>
104        <div class="col-sm-9">
105            <input type="password" class="form-control" id="SMTP_AUTH_PASS" name="SMTP_AUTH_PASS" value="">
106            <p class="small text-muted">
107                <?= /* I18N: Help text for the "Password" site configuration setting */ I18N::translate('The password required for authentication with the SMTP server.') ?>
108            </p>
109        </div>
110    </div>
111
112    <!-- SMTP_SSL -->
113    <div class="row form-group">
114        <label for="SMTP_SSL" class="col-sm-3 col-form-label">
115            <?= /* I18N: A configuration setting */ I18N::translate('Secure connection') ?>
116        </label>
117        <div class="col-sm-9">
118            <?= Bootstrap4::select($mail_ssl_options, Site::getPreference('SMTP_SSL'), ['id' => 'SMTP_SSL', 'name' => 'SMTP_SSL']) ?>
119            <p class="small text-muted">
120                <?= /* I18N: Help text for the “Secure connection” site configuration setting */ I18N::translate('Most servers do not use secure connections.') ?>
121            </p>
122        </div>
123    </div>
124
125    <!-- SMTP_HELO -->
126    <div class="row form-group">
127        <label for="SMTP_HELO" class="col-sm-3 col-form-label">
128            <?= /* I18N: A configuration setting */ I18N::translate('Sending server name') ?>
129        </label>
130        <div class="col-sm-9">
131            <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-]+)*">
132            <p class="small text-muted">
133                <?= /* 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.') ?>
134            </p>
135        </div>
136    </div>
137
138    <div class="row form-group">
139        <div class="offset-sm-3 col-sm-9">
140            <button type="submit" class="btn btn-primary">
141                <?= view('icons/save') ?>
142                <?= I18N::translate('save') ?>
143            </button>
144
145            <a href="<?= e(route('admin-control-panel')) ?>" class="btn btn-secondary">
146                <?= view('icons/cancel') ?>
147                <?= I18N::translate('cancel') ?>
148            </a>
149        </div>
150    </div>
151</form>
152