mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-20 22:42:53 -05:00
Ability to not send welcome email (#10293)
no issue - We need to be able to not send the welcome email if needed - Intruduces a new possible config setting `sendWelcomeEmail` which is set to `true` by default
This commit is contained in:
parent
aa8e75914d
commit
506d013f25
2 changed files with 27 additions and 22 deletions
|
@ -531,28 +531,32 @@ authentication = {
|
|||
|
||||
common.events.emit('setup.completed', setupUser);
|
||||
|
||||
return mail.utils.generateContent({data: data, template: 'welcome'})
|
||||
.then((content) => {
|
||||
const message = {
|
||||
to: setupUser.email,
|
||||
subject: common.i18n.t('common.api.authentication.mail.yourNewGhostBlog'),
|
||||
html: content.html,
|
||||
text: content.text
|
||||
},
|
||||
payload = {
|
||||
mail: [{
|
||||
message: message,
|
||||
options: {}
|
||||
}]
|
||||
};
|
||||
if (config.get('sendWelcomeEmail')) {
|
||||
return mail.utils.generateContent({data: data, template: 'welcome'})
|
||||
.then((content) => {
|
||||
const message = {
|
||||
to: setupUser.email,
|
||||
subject: common.i18n.t('common.api.authentication.mail.yourNewGhostBlog'),
|
||||
html: content.html,
|
||||
text: content.text
|
||||
},
|
||||
payload = {
|
||||
mail: [{
|
||||
message: message,
|
||||
options: {}
|
||||
}]
|
||||
};
|
||||
|
||||
mailAPI.send(payload, {context: {internal: true}})
|
||||
.catch((err) => {
|
||||
err.context = common.i18n.t('errors.api.authentication.unableToSendWelcomeEmail');
|
||||
common.logging.error(err);
|
||||
});
|
||||
})
|
||||
.return(setupUser);
|
||||
mailAPI.send(payload, {context: {internal: true}})
|
||||
.catch((err) => {
|
||||
err.context = common.i18n.t('errors.api.authentication.unableToSendWelcomeEmail');
|
||||
common.logging.error(err);
|
||||
});
|
||||
})
|
||||
.return(setupUser);
|
||||
}
|
||||
|
||||
return setupUser;
|
||||
}
|
||||
|
||||
function formatResponse(setupUser) {
|
||||
|
|
|
@ -83,5 +83,6 @@
|
|||
"resize": true
|
||||
},
|
||||
"compress": true,
|
||||
"preloadHeaders": false
|
||||
"preloadHeaders": false,
|
||||
"sendWelcomeEmail": true
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue