Skip to content

Commit

Permalink
fix(api): add mail from header
Browse files Browse the repository at this point in the history
  • Loading branch information
Mefjus committed Mar 29, 2021
1 parent 1105002 commit 1874353
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 6 deletions.
5 changes: 3 additions & 2 deletions packages/api/src/modules/config/config-loader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,9 @@ export class ConfigLoader {
user: this.envConfigService.get('ETHEREAL_USER'),
pass: this.envConfigService.get('ETHEREAL_PASSWORD'),
},
sender: this.envConfigService.get('SENDER'),
replyTo: this.envConfigService.get('REPLY_TO', isProd),
sender: this.envConfigService.get('SENDER', false) || defaultValues.mailer.sender,
replyTo: this.envConfigService.get('REPLY_TO', false) || defaultValues.mailer.replyTo,
from: this.envConfigService.get('FROM', false) || defaultValues.mailer.from,
},
sentry: {
debug: this.envConfigService.get('SENTRY_DEBUG', false, convertToBoolean),
Expand Down
5 changes: 3 additions & 2 deletions packages/api/src/modules/config/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,9 @@ export class Config {
user: string | undefined;
pass: string | undefined;
};
sender: string | undefined;
replyTo: string | undefined;
sender: string;
replyTo: string;
from: string;
};

passwordReset: {
Expand Down
6 changes: 6 additions & 0 deletions packages/api/src/modules/config/defaultValues.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@ const defaultValues = {
expirationTimeWithoutKeepMeLoggedIn: '12h',
},
},

mailer: {
from: 'no-reply@sg.com',
sender: 'Smart Gate',
replyTo: 'sg@gmail.com',
},
};

export default defaultValues;
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ interface MailerConfig<T = MailerAuthConfig> {

interface SendEmailConfig {
sender: string;
from: string;
replyTo: string;
}

Expand Down Expand Up @@ -60,8 +61,9 @@ export class MailerConfigService {

public getSendEmailConfig(): SendEmailConfig {
return {
sender: this.config.mailer.sender || 'Smart Gate',
replyTo: this.config.mailer.replyTo || 'sg@gmail.com',
from: this.config.mailer.from,
sender: this.config.mailer.sender,
replyTo: this.config.mailer.replyTo,
};
}

Expand Down

0 comments on commit 1874353

Please sign in to comment.