Skip to content
Open
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
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,7 @@ build
electron

.local.env

# new
.DS_Store

5 changes: 3 additions & 2 deletions backend/src/email.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ import nodemailer from "nodemailer";

const router = express.Router();

const sendEmail = async (to: string, subject: string, text: string) => {
// 增加 export 使得 sendEmail 函数可以被其他脚本调用
export const sendEmail = async (to: string, subject: string, text: string) => {
const transporter = nodemailer.createTransport({
host: process.env.EMAIL_HOST!,
port: Number(process.env.EMAIL_PORT!),
Expand All @@ -29,7 +30,7 @@ router.post("/contact-us", async (req, res) => {
}
try {
const result = await sendEmail(
process.env.EMAIL_ADDRESS!,
`${email}`,
"Web Workshop Contact Us Form",
`Message from ${name} <${email}>:\n\n${message}`,
);
Expand Down
Loading