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