Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add "email.senderAddress" config #1133

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/util/config/types/EmailConfiguration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import { SendGridConfiguration } from "./subconfigurations/email/SendGrid";

export class EmailConfiguration {
provider: string | null = null;
senderAddress: string | null = null;
smtp: SMTPConfiguration = new SMTPConfiguration();
mailgun: MailGunConfiguration = new MailGunConfiguration();
mailjet: MailJetConfiguration = new MailJetConfiguration();
Expand Down
1 change: 0 additions & 1 deletion src/util/entities/UserSettings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,6 @@ export class UserSettings extends BaseClassWithoutId {

@Column({ nullable: true })
view_nsfw_guilds: boolean = true;

}

interface CustomStatus {
Expand Down
4 changes: 3 additions & 1 deletion src/util/util/email/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,9 @@ export const Email: {

const message = {
from:
Config.get().general.correspondenceEmail || "noreply@localhost",
Config.get().email.senderAddress ||
Config.get().general.correspondenceEmail ||
"noreply@localhost",
to: email,
subject,
html,
Expand Down
7 changes: 5 additions & 2 deletions src/util/util/email/transports/SMTP.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,12 @@ export default async function () {
if (!host || !port || secure === null || !username || !password)
return console.error("[Email] SMTP has not been configured correctly.");

if (!Config.get().general.correspondenceEmail)
if (
!Config.get().email.senderAddress &&
!Config.get().general.correspondenceEmail
)
return console.error(
"[Email] Correspondence email has not been configured! This is used as the sender email address.",
'[Email] You have to configure either "email_senderAddress" or "general_correspondenceEmail" for emails to work. The configured value is used as the sender address.',
);

// construct the transporter
Expand Down
Loading