xref: /webtrees/resources/views/admin/site-mail.phtml (revision 0c0910bf0f275a14f35d2ccdf698f91f79e269d4)
11dcac87eSGreg Roach<?php
21dcac87eSGreg Roach
3*0c0910bfSGreg Roachuse Fisharebest\Webtrees\Http\RequestHandlers\ControlPanel;
41dcac87eSGreg Roachuse Fisharebest\Webtrees\I18N;
51dcac87eSGreg Roachuse Fisharebest\Webtrees\View;
61dcac87eSGreg Roach
71dcac87eSGreg Roach/**
81dcac87eSGreg Roach * @var string   $DKIM_DOMAIN
91dcac87eSGreg Roach * @var string   $DKIM_KEY
101dcac87eSGreg Roach * @var string   $DKIM_SELECTOR
111dcac87eSGreg Roach * @var string   $SMTP_ACTIVE
121dcac87eSGreg Roach * @var string   $SMTP_AUTH
131dcac87eSGreg Roach * @var string   $SMTP_AUTH_USER
141dcac87eSGreg Roach * @var string   $SMTP_FROM_NAME
151dcac87eSGreg Roach * @var string   $SMTP_HELO
161dcac87eSGreg Roach * @var string   $SMTP_HOST
171dcac87eSGreg Roach * @var string   $SMTP_PORT
181dcac87eSGreg Roach * @var string   $SMTP_SSL
191dcac87eSGreg Roach * @var string[] $mail_ssl_options
201dcac87eSGreg Roach * @var string[] $mail_transport_options
211dcac87eSGreg Roach * @var bool     $smtp_helo_valid
221dcac87eSGreg Roach * @var bool     $smtp_from_name_valid
231dcac87eSGreg Roach * @var string   $title
241dcac87eSGreg Roach */
251dcac87eSGreg Roach?>
26dd6b2bfcSGreg Roach
27*0c0910bfSGreg Roach<?= view('components/breadcrumbs', ['links' => [route(ControlPanel::class) => I18N::translate('Control panel'), $title]]) ?>
28dd6b2bfcSGreg Roach
29dd6b2bfcSGreg Roach<h1><?= $title ?></h1>
30dd6b2bfcSGreg Roach
31dd6b2bfcSGreg Roach<p class="alert alert-info">
32dd6b2bfcSGreg 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>' ?>
33dd6b2bfcSGreg Roach</p>
34dd6b2bfcSGreg Roach
3583615acfSGreg Roach<form method="post" action="<?= e(route('admin-site-mail-update')) ?>" class="form-horizontal">
36dd6b2bfcSGreg Roach    <?= csrf_field() ?>
37dd6b2bfcSGreg Roach
38dd6b2bfcSGreg Roach    <div class="row form-group">
39dd6b2bfcSGreg Roach        <label for="SMTP_ACTIVE" class="col-sm-3 col-form-label">
401dcac87eSGreg Roach            <?= /* I18N: A configuration setting */
411dcac87eSGreg Roach            I18N::translate('Messages') ?>
42dd6b2bfcSGreg Roach        </label>
43dd6b2bfcSGreg Roach        <div class="col-sm-9">
441dcac87eSGreg Roach            <?= view('components/select', ['name' => 'SMTP_ACTIVE', 'selected' => $SMTP_ACTIVE, 'options' => $mail_transport_options]) ?>
45dd6b2bfcSGreg Roach            <p class="small text-muted">
461dcac87eSGreg Roach                <?= /* I18N: Help text for the “Messages” site configuration setting */
471dcac87eSGreg Roach                I18N::translate('webtrees needs to send emails, such as password reminders and website notifications.') ?>
48dd6b2bfcSGreg Roach            </p>
49dd6b2bfcSGreg Roach        </div>
50dd6b2bfcSGreg Roach    </div>
51dd6b2bfcSGreg Roach
52dd6b2bfcSGreg Roach    <div class="row form-group">
53dd6b2bfcSGreg Roach        <label for="SMTP_FROM_NAME" class="col-sm-3 col-form-label">
541dcac87eSGreg Roach            <?= /* I18N: A configuration setting */
551dcac87eSGreg Roach            I18N::translate('Sender name') ?>
56dd6b2bfcSGreg Roach        </label>
57dd6b2bfcSGreg Roach        <div class="col-sm-9">
581dcac87eSGreg Roach                <input type="email" class="form-control" id="SMTP_FROM_NAME" name="SMTP_FROM_NAME" value="<?= e($SMTP_FROM_NAME) ?>" maxlength="255">
59dd6b2bfcSGreg Roach            <p class="small text-muted">
601dcac87eSGreg Roach                <?= /* I18N: Help text for the “Sender name” site configuration setting */
611dcac87eSGreg Roach                I18N::translate('This name is used in the “From” field, when sending automatic emails from this server.') ?>
62dd6b2bfcSGreg Roach            </p>
631dcac87eSGreg Roach
641dcac87eSGreg Roach            <?php if (!$smtp_from_name_valid) : ?>
651dcac87eSGreg Roach            <p class="alert alert-warning">
661dcac87eSGreg Roach                <?= I18N::translate('Most mail servers require a valid email address.') ?>
671dcac87eSGreg Roach            </p>
681dcac87eSGreg Roach            <?php endif ?>
69dd6b2bfcSGreg Roach        </div>
70dd6b2bfcSGreg Roach    </div>
71dd6b2bfcSGreg Roach
72dd6b2bfcSGreg Roach    <h2><?= I18N::translate('SMTP mail server') ?></h2>
73dd6b2bfcSGreg Roach
74dd6b2bfcSGreg Roach    <div class="row form-group">
75dd6b2bfcSGreg Roach        <label for="SMTP_HOST" class="col-sm-3 col-form-label">
761dcac87eSGreg Roach            <?= /* I18N: A configuration setting */
771dcac87eSGreg Roach            I18N::translate('Server name') ?>
78dd6b2bfcSGreg Roach        </label>
79dd6b2bfcSGreg Roach        <div class="col-sm-9">
801dcac87eSGreg 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-]+)*">
81dd6b2bfcSGreg Roach            <p class="small text-muted">
821dcac87eSGreg Roach                <?= /* I18N: Help text for the “Server name” site configuration setting */
831dcac87eSGreg 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.') ?>
84dd6b2bfcSGreg Roach            </p>
85dd6b2bfcSGreg Roach        </div>
86dd6b2bfcSGreg Roach    </div>
87dd6b2bfcSGreg Roach
88dd6b2bfcSGreg Roach    <div class="row form-group">
89dd6b2bfcSGreg Roach        <label for="SMTP_PORT" class="col-sm-3 col-form-label">
901dcac87eSGreg Roach            <?= /* I18N: A configuration setting */
911dcac87eSGreg Roach            I18N::translate('Port number') ?>
92dd6b2bfcSGreg Roach        </label>
93dd6b2bfcSGreg Roach        <div class="col-sm-9">
941dcac87eSGreg Roach            <input type="text" class="form-control" id="SMTP_PORT" name="SMTP_PORT" value="<?= e($SMTP_PORT) ?>" pattern="[0-9]*" placeholder="25" maxlength="5">
95dd6b2bfcSGreg Roach            <p class="small text-muted">
961dcac87eSGreg Roach                <?= /* I18N: Help text for the "Port number" site configuration setting */
971dcac87eSGreg Roach                I18N::translate('By default, SMTP works on port 25.') ?>
98dd6b2bfcSGreg Roach            </p>
99dd6b2bfcSGreg Roach        </div>
100dd6b2bfcSGreg Roach    </div>
101dd6b2bfcSGreg Roach
102dd6b2bfcSGreg Roach    <fieldset class="form-group">
103dd6b2bfcSGreg Roach        <div class="row">
104dd6b2bfcSGreg Roach            <legend class="col-form-label col-sm-3">
1051dcac87eSGreg Roach                <?= /* I18N: A configuration setting */
1061dcac87eSGreg Roach                I18N::translate('Use password') ?>
107dd6b2bfcSGreg Roach            </legend>
108dd6b2bfcSGreg Roach            <div class="col-sm-9">
1091dcac87eSGreg Roach                <?= view('components/radios-inline', ['name' => 'SMTP_AUTH', 'options' => [I18N::translate('no'), I18N::translate('yes')], 'selected' => (int) $SMTP_AUTH]) ?>
110dd6b2bfcSGreg Roach                <p class="small text-muted">
1111dcac87eSGreg Roach                    <?= /* I18N: Help text for the “Use password” site configuration setting */
1121dcac87eSGreg Roach                    I18N::translate('Most SMTP servers require a password.') ?>
113dd6b2bfcSGreg Roach                </p>
114dd6b2bfcSGreg Roach            </div>
115dd6b2bfcSGreg Roach        </div>
116dd6b2bfcSGreg Roach    </fieldset>
117dd6b2bfcSGreg Roach
118dd6b2bfcSGreg Roach    <div class="row form-group">
119dd6b2bfcSGreg Roach        <label for="SMTP_AUTH_USER" class="col-sm-3 col-form-label">
1201dcac87eSGreg Roach            <?= /* I18N: A configuration setting */
1211dcac87eSGreg Roach            I18N::translate('Username') ?>
122dd6b2bfcSGreg Roach        </label>
123dd6b2bfcSGreg Roach        <div class="col-sm-9">
1241dcac87eSGreg Roach            <input type="text" class="form-control" id="SMTP_AUTH_USER" name="SMTP_AUTH_USER" value="<?= e($SMTP_AUTH_USER) ?>" maxlength="255">
125dd6b2bfcSGreg Roach            <p class="small text-muted">
1261dcac87eSGreg Roach                <?= /* I18N: Help text for the "Username" site configuration setting */
1271dcac87eSGreg Roach                I18N::translate('The username required for authentication with the SMTP server.') ?>
128dd6b2bfcSGreg Roach            </p>
129dd6b2bfcSGreg Roach        </div>
130dd6b2bfcSGreg Roach    </div>
131dd6b2bfcSGreg Roach
132dd6b2bfcSGreg Roach    <div class="row form-group">
133dd6b2bfcSGreg Roach        <label for="SMTP_AUTH_PASS" class="col-sm-3 col-form-label">
1341dcac87eSGreg Roach            <?= /* I18N: A configuration setting */
1351dcac87eSGreg Roach            I18N::translate('Password') ?>
136dd6b2bfcSGreg Roach        </label>
137dd6b2bfcSGreg Roach        <div class="col-sm-9">
1381f1ffa65SGreg Roach            <input type="password" class="form-control" id="SMTP_AUTH_PASS" name="SMTP_AUTH_PASS" value="" autocomplete="off">
139dd6b2bfcSGreg Roach            <p class="small text-muted">
1401dcac87eSGreg Roach                <?= /* I18N: Help text for the "Password" site configuration setting */
1411dcac87eSGreg Roach                I18N::translate('The password required for authentication with the SMTP server.') ?>
142dd6b2bfcSGreg Roach            </p>
143dd6b2bfcSGreg Roach        </div>
144dd6b2bfcSGreg Roach    </div>
145dd6b2bfcSGreg Roach
146dd6b2bfcSGreg Roach    <div class="row form-group">
147dd6b2bfcSGreg Roach        <label for="SMTP_SSL" class="col-sm-3 col-form-label">
1481dcac87eSGreg Roach            <?= /* I18N: A configuration setting */
1491dcac87eSGreg Roach            I18N::translate('Secure connection') ?>
150dd6b2bfcSGreg Roach        </label>
151dd6b2bfcSGreg Roach        <div class="col-sm-9">
1521dcac87eSGreg Roach            <?= view('components/select', ['name' => 'SMTP_SSL', 'selected' => $SMTP_SSL, 'options' => $mail_ssl_options]) ?>
153dd6b2bfcSGreg Roach            <p class="small text-muted">
1541dcac87eSGreg Roach                <?= /* I18N: Help text for the “Secure connection” site configuration setting */
1551dcac87eSGreg Roach                I18N::translate('Most servers do not use secure connections.') ?>
156dd6b2bfcSGreg Roach            </p>
157dd6b2bfcSGreg Roach        </div>
158dd6b2bfcSGreg Roach    </div>
159dd6b2bfcSGreg Roach
160dd6b2bfcSGreg Roach    <div class="row form-group">
161dd6b2bfcSGreg Roach        <label for="SMTP_HELO" class="col-sm-3 col-form-label">
1621dcac87eSGreg Roach            <?= /* I18N: A configuration setting */
1631dcac87eSGreg Roach            I18N::translate('Sending server name') ?>
164dd6b2bfcSGreg Roach        </label>
165dd6b2bfcSGreg Roach        <div class="col-sm-9">
1661dcac87eSGreg 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-]+)*">
167dd6b2bfcSGreg Roach            <p class="small text-muted">
1681dcac87eSGreg Roach                <?= /* I18N: Help text for the "Sending server name" site configuration setting */
1691dcac87eSGreg Roach                I18N::translate('Most mail servers require that the sending server identifies itself correctly, using a valid domain name.') ?>
170dd6b2bfcSGreg Roach            </p>
1711dcac87eSGreg Roach
1721dcac87eSGreg Roach            <?php if (!$smtp_helo_valid) : ?>
1731dcac87eSGreg Roach                <p class="alert alert-warning">
1741dcac87eSGreg Roach                    <?= I18N::translate('Most mail servers require a valid domain name.') ?>
1751dcac87eSGreg Roach                </p>
1761dcac87eSGreg Roach            <?php endif ?>
177dd6b2bfcSGreg Roach        </div>
178dd6b2bfcSGreg Roach    </div>
179dd6b2bfcSGreg Roach
1804d99955eSGreg Roach    <h2>
1811dcac87eSGreg Roach        <?= /* I18N: https://en.wikipedia.org/wiki/DomainKeys_Identified_Mail */
1821dcac87eSGreg Roach        I18N::translate('DKIM digital signature') ?>
1834d99955eSGreg Roach    </h2>
1844d99955eSGreg Roach
1854d99955eSGreg Roach    <div class="row form-group">
1864d99955eSGreg Roach        <label for="DKIM_DOMAIN" class="col-sm-3 col-form-label">
1874d99955eSGreg Roach            <?= I18N::translate('Domain name') ?>
1884d99955eSGreg Roach        </label>
1894d99955eSGreg Roach        <div class="col-sm-9">
1901dcac87eSGreg Roach            <input type="text" class="form-control" id="DKIM_DOMAIN" name="DKIM_DOMAIN" value="<?= e($DKIM_DOMAIN) ?>" maxlength="255">
1914d99955eSGreg Roach        </div>
1924d99955eSGreg Roach    </div>
1934d99955eSGreg Roach
1944d99955eSGreg Roach    <div class="row form-group">
1954d99955eSGreg Roach        <label for="DKIM_SELECTOR" class="col-sm-3 col-form-label">
1964d99955eSGreg Roach            <?= I18N::translate('Selector') ?>
1974d99955eSGreg Roach        </label>
1984d99955eSGreg Roach        <div class="col-sm-9">
1991dcac87eSGreg Roach            <input type="text" class="form-control" id="DKIM_SELECTOR" name="DKIM_SELECTOR" value="<?= e($DKIM_SELECTOR) ?>" maxlength="255">
2004d99955eSGreg Roach        </div>
2014d99955eSGreg Roach    </div>
2024d99955eSGreg Roach
2034d99955eSGreg Roach    <div class="row form-group">
2044d99955eSGreg Roach        <label for="DKIM_KEY" class="col-sm-3 col-form-label">
2054d99955eSGreg Roach            <?= I18N::translate('Private key') ?>
2064d99955eSGreg Roach        </label>
2074d99955eSGreg Roach        <div class="col-sm-9">
2081dcac87eSGreg Roach            <textarea class="form-control" id="DKIM_KEY" name="DKIM_KEY"><?= e($DKIM_KEY) ?></textarea>
2094d99955eSGreg Roach        </div>
2104d99955eSGreg Roach    </div>
2114d99955eSGreg Roach
2121dcac87eSGreg Roach    <hr>
2131dcac87eSGreg Roach
214dd6b2bfcSGreg Roach    <div class="row form-group">
215dd6b2bfcSGreg Roach        <div class="offset-sm-3 col-sm-9">
216dd6b2bfcSGreg Roach            <button type="submit" class="btn btn-primary">
217dd6b2bfcSGreg Roach                <?= view('icons/save') ?>
218dd6b2bfcSGreg Roach                <?= I18N::translate('save') ?>
219dd6b2bfcSGreg Roach            </button>
220dd6b2bfcSGreg Roach
221*0c0910bfSGreg Roach            <a href="<?= e(route(ControlPanel::class)) ?>" class="btn btn-secondary">
222dd6b2bfcSGreg Roach                <?= view('icons/cancel') ?>
223dd6b2bfcSGreg Roach                <?= I18N::translate('cancel') ?>
224dd6b2bfcSGreg Roach            </a>
225dd6b2bfcSGreg Roach        </div>
226dd6b2bfcSGreg Roach    </div>
227dd6b2bfcSGreg Roach</form>
228510d3f2fSGreg Roach
229510d3f2fSGreg Roach<?php View::push('javascript') ?>
230510d3f2fSGreg Roach<script>
2311dcac87eSGreg Roach    $("#SMTP_AUTH_PASS").hideShowPassword("infer", true);
232510d3f2fSGreg Roach</script>
233510d3f2fSGreg Roach<?php View::endpush() ?>
234