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