xref: /webtrees/resources/views/admin/site-mail.phtml (revision 1dcac87eebe70674246739db6483615674aa122a)
1*1dcac87eSGreg Roach<?php
2*1dcac87eSGreg Roach
3*1dcac87eSGreg Roachuse Fisharebest\Webtrees\I18N;
4*1dcac87eSGreg Roachuse Fisharebest\Webtrees\View;
5*1dcac87eSGreg Roach
6*1dcac87eSGreg Roach/**
7*1dcac87eSGreg Roach * @var string   $DKIM_DOMAIN
8*1dcac87eSGreg Roach * @var string   $DKIM_KEY
9*1dcac87eSGreg Roach * @var string   $DKIM_SELECTOR
10*1dcac87eSGreg Roach * @var string   $SMTP_ACTIVE
11*1dcac87eSGreg Roach * @var string   $SMTP_AUTH
12*1dcac87eSGreg Roach * @var string   $SMTP_AUTH_USER
13*1dcac87eSGreg Roach * @var string   $SMTP_FROM_NAME
14*1dcac87eSGreg Roach * @var string   $SMTP_HELO
15*1dcac87eSGreg Roach * @var string   $SMTP_HOST
16*1dcac87eSGreg Roach * @var string   $SMTP_PORT
17*1dcac87eSGreg Roach * @var string   $SMTP_SSL
18*1dcac87eSGreg Roach * @var string[] $mail_ssl_options
19*1dcac87eSGreg Roach * @var string[] $mail_transport_options
20*1dcac87eSGreg Roach * @var bool     $smtp_helo_valid
21*1dcac87eSGreg Roach * @var bool     $smtp_from_name_valid
22*1dcac87eSGreg Roach * @var string   $title
23*1dcac87eSGreg Roach */
24*1dcac87eSGreg Roach?>
25dd6b2bfcSGreg Roach
26dd6b2bfcSGreg Roach<?= view('components/breadcrumbs', ['links' => [route('admin-control-panel') => I18N::translate('Control panel'), $title]]) ?>
27dd6b2bfcSGreg Roach
28dd6b2bfcSGreg Roach<h1><?= $title ?></h1>
29dd6b2bfcSGreg Roach
30dd6b2bfcSGreg Roach<p class="alert alert-info">
31dd6b2bfcSGreg Roach    <?= 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>' ?>
32dd6b2bfcSGreg Roach</p>
33dd6b2bfcSGreg Roach
34dd6b2bfcSGreg Roach<form method="post" class="form-horizontal">
35dd6b2bfcSGreg Roach    <?= csrf_field() ?>
36dd6b2bfcSGreg Roach
37dd6b2bfcSGreg Roach    <div class="row form-group">
38dd6b2bfcSGreg Roach        <label for="SMTP_ACTIVE" class="col-sm-3 col-form-label">
39*1dcac87eSGreg Roach            <?= /* I18N: A configuration setting */
40*1dcac87eSGreg Roach            I18N::translate('Messages') ?>
41dd6b2bfcSGreg Roach        </label>
42dd6b2bfcSGreg Roach        <div class="col-sm-9">
43*1dcac87eSGreg Roach            <?= view('components/select', ['name' => 'SMTP_ACTIVE', 'selected' => $SMTP_ACTIVE, 'options' => $mail_transport_options]) ?>
44dd6b2bfcSGreg Roach            <p class="small text-muted">
45*1dcac87eSGreg Roach                <?= /* I18N: Help text for the “Messages” site configuration setting */
46*1dcac87eSGreg Roach                I18N::translate('webtrees needs to send emails, such as password reminders and website notifications.') ?>
47dd6b2bfcSGreg Roach            </p>
48dd6b2bfcSGreg Roach        </div>
49dd6b2bfcSGreg Roach    </div>
50dd6b2bfcSGreg Roach
51dd6b2bfcSGreg Roach    <div class="row form-group">
52dd6b2bfcSGreg Roach        <label for="SMTP_FROM_NAME" class="col-sm-3 col-form-label">
53*1dcac87eSGreg Roach            <?= /* I18N: A configuration setting */
54*1dcac87eSGreg Roach            I18N::translate('Sender name') ?>
55dd6b2bfcSGreg Roach        </label>
56dd6b2bfcSGreg Roach        <div class="col-sm-9">
57*1dcac87eSGreg Roach                <input type="email" class="form-control" id="SMTP_FROM_NAME" name="SMTP_FROM_NAME" value="<?= e($SMTP_FROM_NAME) ?>" maxlength="255">
58dd6b2bfcSGreg Roach            <p class="small text-muted">
59*1dcac87eSGreg Roach                <?= /* I18N: Help text for the “Sender name” site configuration setting */
60*1dcac87eSGreg Roach                I18N::translate('This name is used in the “From” field, when sending automatic emails from this server.') ?>
61dd6b2bfcSGreg Roach            </p>
62*1dcac87eSGreg Roach
63*1dcac87eSGreg Roach            <?php if (!$smtp_from_name_valid) : ?>
64*1dcac87eSGreg Roach            <p class="alert alert-warning">
65*1dcac87eSGreg Roach                <?= I18N::translate('Most mail servers require a valid email address.') ?>
66*1dcac87eSGreg Roach            </p>
67*1dcac87eSGreg Roach            <?php endif ?>
68dd6b2bfcSGreg Roach        </div>
69dd6b2bfcSGreg Roach    </div>
70dd6b2bfcSGreg Roach
71dd6b2bfcSGreg Roach    <h2><?= I18N::translate('SMTP mail server') ?></h2>
72dd6b2bfcSGreg Roach
73dd6b2bfcSGreg Roach    <div class="row form-group">
74dd6b2bfcSGreg Roach        <label for="SMTP_HOST" class="col-sm-3 col-form-label">
75*1dcac87eSGreg Roach            <?= /* I18N: A configuration setting */
76*1dcac87eSGreg Roach            I18N::translate('Server name') ?>
77dd6b2bfcSGreg Roach        </label>
78dd6b2bfcSGreg Roach        <div class="col-sm-9">
79*1dcac87eSGreg Roach            <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-]+)*">
80dd6b2bfcSGreg Roach            <p class="small text-muted">
81*1dcac87eSGreg Roach                <?= /* I18N: Help text for the “Server name” site configuration setting */
82*1dcac87eSGreg Roach                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.') ?>
83dd6b2bfcSGreg Roach            </p>
84dd6b2bfcSGreg Roach        </div>
85dd6b2bfcSGreg Roach    </div>
86dd6b2bfcSGreg Roach
87dd6b2bfcSGreg Roach    <div class="row form-group">
88dd6b2bfcSGreg Roach        <label for="SMTP_PORT" class="col-sm-3 col-form-label">
89*1dcac87eSGreg Roach            <?= /* I18N: A configuration setting */
90*1dcac87eSGreg Roach            I18N::translate('Port number') ?>
91dd6b2bfcSGreg Roach        </label>
92dd6b2bfcSGreg Roach        <div class="col-sm-9">
93*1dcac87eSGreg Roach            <input type="text" class="form-control" id="SMTP_PORT" name="SMTP_PORT" value="<?= e($SMTP_PORT) ?>" pattern="[0-9]*" placeholder="25" maxlength="5">
94dd6b2bfcSGreg Roach            <p class="small text-muted">
95*1dcac87eSGreg Roach                <?= /* I18N: Help text for the "Port number" site configuration setting */
96*1dcac87eSGreg Roach                I18N::translate('By default, SMTP works on port 25.') ?>
97dd6b2bfcSGreg Roach            </p>
98dd6b2bfcSGreg Roach        </div>
99dd6b2bfcSGreg Roach    </div>
100dd6b2bfcSGreg Roach
101dd6b2bfcSGreg Roach    <fieldset class="form-group">
102dd6b2bfcSGreg Roach        <div class="row">
103dd6b2bfcSGreg Roach            <legend class="col-form-label col-sm-3">
104*1dcac87eSGreg Roach                <?= /* I18N: A configuration setting */
105*1dcac87eSGreg Roach                I18N::translate('Use password') ?>
106dd6b2bfcSGreg Roach            </legend>
107dd6b2bfcSGreg Roach            <div class="col-sm-9">
108*1dcac87eSGreg Roach                <?= view('components/radios-inline', ['name' => 'SMTP_AUTH', 'options' => [I18N::translate('no'), I18N::translate('yes')], 'selected' => (int) $SMTP_AUTH]) ?>
109dd6b2bfcSGreg Roach                <p class="small text-muted">
110*1dcac87eSGreg Roach                    <?= /* I18N: Help text for the “Use password” site configuration setting */
111*1dcac87eSGreg Roach                    I18N::translate('Most SMTP servers require a password.') ?>
112dd6b2bfcSGreg Roach                </p>
113dd6b2bfcSGreg Roach            </div>
114dd6b2bfcSGreg Roach        </div>
115dd6b2bfcSGreg Roach    </fieldset>
116dd6b2bfcSGreg Roach
117dd6b2bfcSGreg Roach    <div class="row form-group">
118dd6b2bfcSGreg Roach        <label for="SMTP_AUTH_USER" class="col-sm-3 col-form-label">
119*1dcac87eSGreg Roach            <?= /* I18N: A configuration setting */
120*1dcac87eSGreg Roach            I18N::translate('Username') ?>
121dd6b2bfcSGreg Roach        </label>
122dd6b2bfcSGreg Roach        <div class="col-sm-9">
123*1dcac87eSGreg Roach            <input type="text" class="form-control" id="SMTP_AUTH_USER" name="SMTP_AUTH_USER" value="<?= e($SMTP_AUTH_USER) ?>" maxlength="255">
124dd6b2bfcSGreg Roach            <p class="small text-muted">
125*1dcac87eSGreg Roach                <?= /* I18N: Help text for the "Username" site configuration setting */
126*1dcac87eSGreg Roach                I18N::translate('The username required for authentication with the SMTP server.') ?>
127dd6b2bfcSGreg Roach            </p>
128dd6b2bfcSGreg Roach        </div>
129dd6b2bfcSGreg Roach    </div>
130dd6b2bfcSGreg Roach
131dd6b2bfcSGreg Roach    <div class="row form-group">
132dd6b2bfcSGreg Roach        <label for="SMTP_AUTH_PASS" class="col-sm-3 col-form-label">
133*1dcac87eSGreg Roach            <?= /* I18N: A configuration setting */
134*1dcac87eSGreg Roach            I18N::translate('Password') ?>
135dd6b2bfcSGreg Roach        </label>
136dd6b2bfcSGreg Roach        <div class="col-sm-9">
1371f1ffa65SGreg Roach            <input type="password" class="form-control" id="SMTP_AUTH_PASS" name="SMTP_AUTH_PASS" value="" autocomplete="off">
138dd6b2bfcSGreg Roach            <p class="small text-muted">
139*1dcac87eSGreg Roach                <?= /* I18N: Help text for the "Password" site configuration setting */
140*1dcac87eSGreg Roach                I18N::translate('The password required for authentication with the SMTP server.') ?>
141dd6b2bfcSGreg Roach            </p>
142dd6b2bfcSGreg Roach        </div>
143dd6b2bfcSGreg Roach    </div>
144dd6b2bfcSGreg Roach
145dd6b2bfcSGreg Roach    <div class="row form-group">
146dd6b2bfcSGreg Roach        <label for="SMTP_SSL" class="col-sm-3 col-form-label">
147*1dcac87eSGreg Roach            <?= /* I18N: A configuration setting */
148*1dcac87eSGreg Roach            I18N::translate('Secure connection') ?>
149dd6b2bfcSGreg Roach        </label>
150dd6b2bfcSGreg Roach        <div class="col-sm-9">
151*1dcac87eSGreg Roach            <?= view('components/select', ['name' => 'SMTP_SSL', 'selected' => $SMTP_SSL, 'options' => $mail_ssl_options]) ?>
152dd6b2bfcSGreg Roach            <p class="small text-muted">
153*1dcac87eSGreg Roach                <?= /* I18N: Help text for the “Secure connection” site configuration setting */
154*1dcac87eSGreg Roach                I18N::translate('Most servers do not use secure connections.') ?>
155dd6b2bfcSGreg Roach            </p>
156dd6b2bfcSGreg Roach        </div>
157dd6b2bfcSGreg Roach    </div>
158dd6b2bfcSGreg Roach
159dd6b2bfcSGreg Roach    <div class="row form-group">
160dd6b2bfcSGreg Roach        <label for="SMTP_HELO" class="col-sm-3 col-form-label">
161*1dcac87eSGreg Roach            <?= /* I18N: A configuration setting */
162*1dcac87eSGreg Roach            I18N::translate('Sending server name') ?>
163dd6b2bfcSGreg Roach        </label>
164dd6b2bfcSGreg Roach        <div class="col-sm-9">
165*1dcac87eSGreg Roach            <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-]+)*">
166dd6b2bfcSGreg Roach            <p class="small text-muted">
167*1dcac87eSGreg Roach                <?= /* I18N: Help text for the "Sending server name" site configuration setting */
168*1dcac87eSGreg Roach                I18N::translate('Most mail servers require that the sending server identifies itself correctly, using a valid domain name.') ?>
169dd6b2bfcSGreg Roach            </p>
170*1dcac87eSGreg Roach
171*1dcac87eSGreg Roach            <?php if (!$smtp_helo_valid) : ?>
172*1dcac87eSGreg Roach                <p class="alert alert-warning">
173*1dcac87eSGreg Roach                    <?= I18N::translate('Most mail servers require a valid domain name.') ?>
174*1dcac87eSGreg Roach                </p>
175*1dcac87eSGreg Roach            <?php endif ?>
176dd6b2bfcSGreg Roach        </div>
177dd6b2bfcSGreg Roach    </div>
178dd6b2bfcSGreg Roach
1794d99955eSGreg Roach    <h2>
180*1dcac87eSGreg Roach        <?= /* I18N: https://en.wikipedia.org/wiki/DomainKeys_Identified_Mail */
181*1dcac87eSGreg Roach        I18N::translate('DKIM digital signature') ?>
1824d99955eSGreg Roach    </h2>
1834d99955eSGreg Roach
1844d99955eSGreg Roach    <div class="row form-group">
1854d99955eSGreg Roach        <label for="DKIM_DOMAIN" class="col-sm-3 col-form-label">
1864d99955eSGreg Roach            <?= I18N::translate('Domain name') ?>
1874d99955eSGreg Roach        </label>
1884d99955eSGreg Roach        <div class="col-sm-9">
189*1dcac87eSGreg Roach            <input type="text" class="form-control" id="DKIM_DOMAIN" name="DKIM_DOMAIN" value="<?= e($DKIM_DOMAIN) ?>" maxlength="255">
1904d99955eSGreg Roach        </div>
1914d99955eSGreg Roach    </div>
1924d99955eSGreg Roach
1934d99955eSGreg Roach    <div class="row form-group">
1944d99955eSGreg Roach        <label for="DKIM_SELECTOR" class="col-sm-3 col-form-label">
1954d99955eSGreg Roach            <?= I18N::translate('Selector') ?>
1964d99955eSGreg Roach        </label>
1974d99955eSGreg Roach        <div class="col-sm-9">
198*1dcac87eSGreg Roach            <input type="text" class="form-control" id="DKIM_SELECTOR" name="DKIM_SELECTOR" value="<?= e($DKIM_SELECTOR) ?>" maxlength="255">
1994d99955eSGreg Roach        </div>
2004d99955eSGreg Roach    </div>
2014d99955eSGreg Roach
2024d99955eSGreg Roach    <div class="row form-group">
2034d99955eSGreg Roach        <label for="DKIM_KEY" class="col-sm-3 col-form-label">
2044d99955eSGreg Roach            <?= I18N::translate('Private key') ?>
2054d99955eSGreg Roach        </label>
2064d99955eSGreg Roach        <div class="col-sm-9">
207*1dcac87eSGreg Roach            <textarea class="form-control" id="DKIM_KEY" name="DKIM_KEY"><?= e($DKIM_KEY) ?></textarea>
2084d99955eSGreg Roach        </div>
2094d99955eSGreg Roach    </div>
2104d99955eSGreg Roach
211*1dcac87eSGreg Roach    <hr>
212*1dcac87eSGreg Roach
213dd6b2bfcSGreg Roach    <div class="row form-group">
214dd6b2bfcSGreg Roach        <div class="offset-sm-3 col-sm-9">
215dd6b2bfcSGreg Roach            <button type="submit" class="btn btn-primary">
216dd6b2bfcSGreg Roach                <?= view('icons/save') ?>
217dd6b2bfcSGreg Roach                <?= I18N::translate('save') ?>
218dd6b2bfcSGreg Roach            </button>
219dd6b2bfcSGreg Roach
220dd6b2bfcSGreg Roach            <a href="<?= e(route('admin-control-panel')) ?>" class="btn btn-secondary">
221dd6b2bfcSGreg Roach                <?= view('icons/cancel') ?>
222dd6b2bfcSGreg Roach                <?= I18N::translate('cancel') ?>
223dd6b2bfcSGreg Roach            </a>
224dd6b2bfcSGreg Roach        </div>
225dd6b2bfcSGreg Roach    </div>
226dd6b2bfcSGreg Roach</form>
227510d3f2fSGreg Roach
228510d3f2fSGreg Roach<?php View::push('javascript') ?>
229510d3f2fSGreg Roach<script>
230*1dcac87eSGreg Roach    $("#SMTP_AUTH_PASS").hideShowPassword("infer", true);
231510d3f2fSGreg Roach</script>
232510d3f2fSGreg Roach<?php View::endpush() ?>
233