mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-09 07:25:46 +01:00
Smtp emailer issue 5951 (#5954)
* Fixed typo at emailer.js line 66 (serice -> service) * When custom SMTP user and password is empty no authentication is attempted * Added options to choose custom smtp connection security * Made custom smtp connection security strings translatable * Changed switch to if-else for custom smtp security option * Fixed emailer.js lint errors * Move custom setting to top of list
This commit is contained in:
committed by
Barış Soner Uşaklı
parent
dd5651b859
commit
38900a9964
@@ -15,6 +15,10 @@
|
||||
"smtp-transport.gmail-warning2": "For more information about this workaround, <a href=\"https://nodemailer.com/usage/using-gmail/\">please consult this NodeMailer article on the issue.</a> An alternative would be to utilise a third-party emailer plugin such as SendGrid, Mailgun, etc. <a href=\"{config.relative_path}/admin/extend/plugins\">Browse available plugins here</a>.",
|
||||
"smtp-transport.host": "SMTP Host",
|
||||
"smtp-transport.port": "SMTP Port",
|
||||
"smtp-transport.security": "Connection security",
|
||||
"smtp-transport.security-encrypted": "Encrypted",
|
||||
"smtp-transport.security-starttls": "StartTLS",
|
||||
"smtp-transport.security-none": "None",
|
||||
"smtp-transport.username": "Username",
|
||||
"smtp-transport.username-help": "<b>For the Gmail service,</b> enter the full email address here, especially if you are using a Google Apps managed domain.",
|
||||
"smtp-transport.password": "Password",
|
||||
|
||||
@@ -56,17 +56,33 @@ Emailer.registerApp = function (expressApp) {
|
||||
|
||||
// Enable Gmail transport if enabled in ACP
|
||||
if (parseInt(meta.config['email:smtpTransport:enabled'], 10) === 1) {
|
||||
var smtpOptions = {
|
||||
auth: {
|
||||
var smtpOptions = {};
|
||||
|
||||
if (meta.config['email:smtpTransport:user'] || meta.config['email:smtpTransport:pass']) {
|
||||
smtpOptions.auth = {
|
||||
user: meta.config['email:smtpTransport:user'],
|
||||
pass: meta.config['email:smtpTransport:pass'],
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
if (meta.config['email:smtpTransport:serice'] === 'nodebb-custom-smtp') {
|
||||
if (meta.config['email:smtpTransport:service'] === 'nodebb-custom-smtp') {
|
||||
smtpOptions.port = meta.config['email:smtpTransport:port'];
|
||||
smtpOptions.host = meta.config['email:smtpTransport:host'];
|
||||
|
||||
if (meta.config['email:smtpTransport:security'] === 'NONE') {
|
||||
smtpOptions.secure = false;
|
||||
smtpOptions.requireTLS = false;
|
||||
smtpOptions.ignoreTLS = true;
|
||||
} else if (meta.config['email:smtpTransport:security'] === 'STARTTLS') {
|
||||
smtpOptions.secure = false;
|
||||
smtpOptions.requireTLS = true;
|
||||
smtpOptions.ignoreTLS = false;
|
||||
} else {
|
||||
// meta.config['email:smtpTransport:security'] === 'ENCRYPTED' or undefined
|
||||
smtpOptions.secure = true;
|
||||
smtpOptions.requireTLS = true;
|
||||
smtpOptions.ignoreTLS = false;
|
||||
}
|
||||
} else {
|
||||
smtpOptions.service = meta.config['email:smtpTransport:service'];
|
||||
}
|
||||
|
||||
@@ -40,12 +40,12 @@
|
||||
<div class="form-group">
|
||||
<label for="email:smtpTransport:service"><strong>[[admin/settings/email:smtp-transport.service]]</strong></label>
|
||||
<select class="form-control input-lg" id="email:smtpTransport:service" data-field="email:smtpTransport:service">
|
||||
<option value="nodebb-custom-smtp" style="font-weight: bold">[[admin/settings/email:smtp-transport.service-custom]]</option>
|
||||
<option style="font-size: 10px" disabled> </option>
|
||||
|
||||
<!-- BEGIN services -->
|
||||
<option value="@value">@value</option>
|
||||
<!-- END services -->
|
||||
|
||||
<option style="font-size: 10px" disabled> </option>
|
||||
<option value="nodebb-custom-smtp" style="font-weight: bold">[[admin/settings/email:smtp-transport.service-custom]]</option>
|
||||
</select>
|
||||
<p class="help-block">
|
||||
[[admin/settings/email:smtp-transport.service-help]]
|
||||
@@ -63,6 +63,13 @@
|
||||
|
||||
<label for="email:smtpTransport:port">[[admin/settings/email:smtp-transport.port]]</label>
|
||||
<input type="text" class="form-control input-md" id="email:smtpTransport:port" data-field="email:smtpTransport:port" placeholder="5555">
|
||||
|
||||
<label for="email:smtpTransport:security">[[admin/settings/email:smtp-transport.security]]</label>
|
||||
<select class="form-control" id="email:smtpTransport:security" data-field="email:smtpTransport:security">
|
||||
<option value="ENCRYPTED">[[admin/settings/email:smtp-transport.security-encrypted]]</option>
|
||||
<option value="STARTTLS">[[admin/settings/email:smtp-transport.security-starttls]]</option>
|
||||
<option value="NONE">[[admin/settings/email:smtp-transport.security-none]]</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="email:smtpTransport:user"><strong>[[admin/settings/email:smtp-transport.username]]</strong></label>
|
||||
|
||||
Reference in New Issue
Block a user