Archived
2

fixed mail service

This commit is contained in:
VLE2FE
2020-08-07 08:37:25 +02:00
parent 3ff29845d4
commit 63d14acc3c
3 changed files with 38 additions and 14 deletions

View File

@ -10,7 +10,7 @@ export default class Mail{
static mailPass: string;
static init() {
this.mailPass = Array(64).map(() => Math.floor(Math.random() * 10)).join('');
this.mailPass = Array(64).fill(0).map(() => Math.floor(Math.random() * 10)).join('');
this.uri = JSON.parse(process.env.VCAP_SERVICES).Mail[0].credentials.uri;
this.auth.username = JSON.parse(process.env.VCAP_SERVICES).Mail[0].credentials.username;
this.auth.password = JSON.parse(process.env.VCAP_SERVICES).Mail[0].credentials.password;
@ -48,6 +48,7 @@ export default class Mail{
auth: this.auth
});
}).then(() => { // init done successfully
console.info('Mail service established successfully');
this.send('lukas.veit@bosch.com', 'Mail Service started', new Date().toString());
}).catch(err => { // anywhere an error occurred
console.error(`Mail init error: ${err.request.method} ${err.request.path}: ${err.response.status}`,