mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-09 07:25:46 +01:00
enabled Gmail routing for email fallback
This commit is contained in:
@@ -14,13 +14,26 @@ var async = require('async'),
|
||||
translator = require('../public/src/modules/translator'),
|
||||
|
||||
transports = {
|
||||
direct: nodemailer.createTransport('direct')
|
||||
direct: nodemailer.createTransport('direct'),
|
||||
gmail: undefined
|
||||
},
|
||||
app;
|
||||
|
||||
(function(Emailer) {
|
||||
Emailer.registerApp = function(expressApp) {
|
||||
app = expressApp;
|
||||
|
||||
// Enable Gmail transport if enabled in ACP
|
||||
if (parseInt(meta.config['email:GmailTransport:enabled'], 10) === 1) {
|
||||
transports.gmail = nodemailer.createTransport('SMTP', {
|
||||
service: 'Gmail',
|
||||
auth: {
|
||||
user: meta.config['email:GmailTransport:user'],
|
||||
pass: meta.config['email:GmailTransport:pass']
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
return Emailer;
|
||||
};
|
||||
|
||||
@@ -101,7 +114,8 @@ var async = require('async'),
|
||||
data.text = data.plaintext;
|
||||
delete data.plaintext;
|
||||
|
||||
transports.direct.sendMail(data, callback);
|
||||
winston.verbose('[emailer] Sending email to uid ' + data.uid);
|
||||
transports[transports.gmail ? 'gmail' : 'direct'].sendMail(data, callback);
|
||||
};
|
||||
|
||||
function render(tpl, params, next) {
|
||||
|
||||
@@ -4,9 +4,6 @@
|
||||
<div class="col-sm-2 col-xs-12 settings-header">Email Settings</div>
|
||||
<div class="col-sm-10 col-xs-12">
|
||||
<form>
|
||||
<p>
|
||||
Please ensure that you have installed a third-party emailer (e.g. PostageApp, Mailgun, Mandrill, SendGrid, etc), otherwise emails will not be sent by NodeBB
|
||||
</p>
|
||||
<div class="form-group">
|
||||
<label for="email:from"><strong>Email Address</strong></label>
|
||||
<p class="help-block">
|
||||
@@ -25,6 +22,31 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-sm-2 col-xs-12 settings-header">Gmail Routing</div>
|
||||
<div class="col-sm-10 col-xs-12">
|
||||
<form>
|
||||
<div class="checkbox">
|
||||
<label for="email:GmailTransport:enabled" class="mdl-switch mdl-js-switch mdl-js-ripple-effect">
|
||||
<input class="mdl-switch__input" type="checkbox" id="email:GmailTransport:enabled" data-field="email:GmailTransport:enabled" name="email:GmailTransport:enabled" />
|
||||
<span class="mdl-switch__label">Route emails through a Gmail/Google Apps account</span>
|
||||
</label>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="email:GmailTransport:user"><strong>Username</strong></label>
|
||||
<input type="text" class="form-control input-lg" id="email:GmailTransport:user" data-field="email:GmailTransport:user" placeholder="admin@example.org" /><br />
|
||||
<p class="help-block">
|
||||
Enter the full email address here, especially if you are using a Google Apps managed domain.
|
||||
</p>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="email:GmailTransport:pass"><strong>Password</strong></label>
|
||||
<input type="password" class="form-control input-lg" id="email:GmailTransport:pass" data-field="email:GmailTransport:pass" /><br />
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-sm-2 col-xs-12 settings-header">Edit Email Template</div>
|
||||
<div class="col-sm-10 col-xs-12">
|
||||
|
||||
Reference in New Issue
Block a user