mirror of
https://github.com/wekan/wekan.git
synced 2025-12-16 23:40:13 +01:00
Added MAIL_SERVICE settings for Well Known Email Services https://github.com/wekan/wekan/wiki/Troubleshooting-Mail . Please test.
Thanks to xet7 ! Fixes #3702
This commit is contained in:
parent
2f33a1ecff
commit
ab8e56e16a
14 changed files with 175 additions and 33 deletions
|
|
@ -1,3 +1,5 @@
|
|||
var nodemailer = require('nodemailer');
|
||||
|
||||
// buffer each user's email text in a queue, then flush them in single email
|
||||
Meteor.startup(() => {
|
||||
Notifications.subscribe('email', (user, title, description, params) => {
|
||||
|
|
@ -38,12 +40,28 @@ Meteor.startup(() => {
|
|||
const html = texts.join('<br/>\n\n');
|
||||
user.clearEmailBuffer();
|
||||
try {
|
||||
Email.send({
|
||||
to: user.emails[0].address.toLowerCase(),
|
||||
from: Accounts.emailTemplates.from,
|
||||
subject,
|
||||
html,
|
||||
});
|
||||
if (process.env.MAIL_SERVICE !== '') {
|
||||
let transporter = nodemailer.createTransport({
|
||||
service: process.env.MAIL_SERVICE,
|
||||
auth: {
|
||||
user: process.env.MAIL_SERVICE_USER,
|
||||
pass: process.env.MAIL_SERVICE_PASSWORD
|
||||
},
|
||||
})
|
||||
let info = transporter.sendMail({
|
||||
to: user.emails[0].address.toLowerCase(),
|
||||
from: Accounts.emailTemplates.from,
|
||||
subject,
|
||||
html,
|
||||
})
|
||||
} else {
|
||||
Email.send({
|
||||
to: user.emails[0].address.toLowerCase(),
|
||||
from: Accounts.emailTemplates.from,
|
||||
subject,
|
||||
html,
|
||||
});
|
||||
}
|
||||
} catch (e) {
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue