Skip to content

Commit

Permalink
Add email from
Browse files Browse the repository at this point in the history
  • Loading branch information
soruly committed Nov 25, 2024
1 parent b0e8d81 commit bbfebb6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ SOLA_SOLR_SIZE=1
# EMAIL_SMTP_PORT=587
# EMAIL_USER=
# EMAIL_PASS=
# EMAIL_FROM

# Sponsor setting, leave empty to disable
# WEBHOOK_GITHUB_SECRET=
Expand Down
6 changes: 3 additions & 3 deletions src/lib/create-new-user.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import nodemailer from "nodemailer";
import generateAPIKey from "./generate-api-key.js";

const { SOLA_DB_NAME, TRACE_API_SALT, EMAIL_SMTP, EMAIL_SMTP_PORT } = process.env;
let { EMAIL_USER, EMAIL_PASS } = process.env;
let { EMAIL_USER, EMAIL_PASS, EMAIL_FROM } = process.env;

const __filename = new URL("", import.meta.url).pathname;
const __dirname = new URL(".", import.meta.url).pathname;
Expand Down Expand Up @@ -52,7 +52,7 @@ export default async (knex, email, tier, full_name = "") => {
EMAIL_PASS = account.pass;
}

if (!EMAIL_SMTP || !EMAIL_SMTP_PORT || !EMAIL_USER || !EMAIL_PASS) return;
if (!EMAIL_SMTP || !EMAIL_SMTP_PORT || !EMAIL_USER || !EMAIL_PASS || !EMAIL_FROM) return;
const transporter = nodemailer.createTransport({
host: EMAIL_SMTP,
port: Number(EMAIL_SMTP_PORT),
Expand All @@ -64,7 +64,7 @@ export default async (knex, email, tier, full_name = "") => {
});

const info = await transporter.sendMail({
from: `"trace.moe" <${EMAIL_USER}>`,
from: `"trace.moe" <${EMAIL_FROM}>`,
to: email,
bcc: EMAIL_USER,
subject: "Thank you for supporting trace.moe",
Expand Down

0 comments on commit bbfebb6

Please sign in to comment.