@@ -0,0 +1,11 @@
|
||||
<%if (format === 'text') { %>
|
||||
|
||||
Test Email from <%= fqdn %>,
|
||||
|
||||
if you can read this, your Cloudron email settings are good.
|
||||
|
||||
Sent at: <%= new Date().toUTCString() %>
|
||||
|
||||
<% } else { %>
|
||||
|
||||
<% } %>
|
||||
+17
-2
@@ -30,6 +30,8 @@ exports = module.exports = {
|
||||
FEEDBACK_TYPE_UPGRADE_REQUEST: 'upgrade_request',
|
||||
sendFeedback: sendFeedback,
|
||||
|
||||
sendTestMail: sendTestMail,
|
||||
|
||||
_getMailQueue: _getMailQueue,
|
||||
_clearMailQueue: _clearMailQueue
|
||||
};
|
||||
@@ -552,8 +554,8 @@ function sendFeedback(user, type, subject, description) {
|
||||
type === exports.FEEDBACK_TYPE_UPGRADE_REQUEST ||
|
||||
type === exports.FEEDBACK_TYPE_APP_ERROR);
|
||||
|
||||
var mailOptions = {
|
||||
from: mailConfig().from,
|
||||
var mailOptions = {
|
||||
from: mailConfig().from,
|
||||
to: 'support@cloudron.io',
|
||||
subject: util.format('[%s] %s - %s', type, config.fqdn(), subject),
|
||||
text: render('feedback.ejs', { fqdn: config.fqdn(), type: type, user: user, subject: subject, description: description, format: 'text'})
|
||||
@@ -562,6 +564,19 @@ function sendFeedback(user, type, subject, description) {
|
||||
enqueue(mailOptions);
|
||||
}
|
||||
|
||||
function sendTestMail(email) {
|
||||
assert.strictEqual(typeof email, 'string');
|
||||
|
||||
var mailOptions = {
|
||||
from: mailConfig().from,
|
||||
to: email,
|
||||
subject: util.format('Test Email from %s', config.fqdn()),
|
||||
text: render('test.ejs', { fqdn: config.fqdn(), format: 'text'})
|
||||
};
|
||||
|
||||
enqueue(mailOptions);
|
||||
}
|
||||
|
||||
function _getMailQueue() {
|
||||
return gMailQueue;
|
||||
}
|
||||
|
||||
+12
-1
@@ -15,7 +15,8 @@ exports = module.exports = {
|
||||
feedback: feedback,
|
||||
checkForUpdates: checkForUpdates,
|
||||
getLogs: getLogs,
|
||||
getLogStream: getLogStream
|
||||
getLogStream: getLogStream,
|
||||
sendTestMail: sendTestMail
|
||||
};
|
||||
|
||||
var assert = require('assert'),
|
||||
@@ -301,3 +302,13 @@ function getLogStream(req, res, next) {
|
||||
logStream.on('error', res.end.bind(res, null));
|
||||
});
|
||||
}
|
||||
|
||||
function sendTestMail(req, res, next) {
|
||||
assert.strictEqual(typeof req.body, 'object');
|
||||
|
||||
if (!req.body.email || typeof req.body.email !== 'string') return next(new HttpError(400, 'email must be a non-empty string'));
|
||||
|
||||
mailer.sendTestMail(req.body.email);
|
||||
|
||||
next(new HttpSuccess(202));
|
||||
}
|
||||
|
||||
+2
-1
@@ -124,7 +124,8 @@ function initializeExpressSync() {
|
||||
router.put ('/api/v1/cloudron/ssh/authorized_keys', cloudronScope, routes.user.requireAdmin, routes.ssh.addAuthorizedKey);
|
||||
router.get ('/api/v1/cloudron/ssh/authorized_keys/:identifier', cloudronScope, routes.user.requireAdmin, routes.ssh.getAuthorizedKey);
|
||||
router.del ('/api/v1/cloudron/ssh/authorized_keys/:identifier', cloudronScope, routes.user.requireAdmin, routes.ssh.delAuthorizedKey);
|
||||
router.get ('/api/v1/cloudron/eventlog', settingsScope, routes.user.requireAdmin, routes.eventlog.get);
|
||||
router.get ('/api/v1/cloudron/eventlog', cloudronScope, routes.user.requireAdmin, routes.eventlog.get);
|
||||
router.post('/api/v1/cloudron/send_test_mail', cloudronScope, routes.user.requireAdmin, routes.cloudron.sendTestMail);
|
||||
|
||||
// profile api, working off the user behind the provided token
|
||||
router.get ('/api/v1/profile', profileScope, routes.profile.get);
|
||||
|
||||
Reference in New Issue
Block a user