diff --git a/.env.example b/.env.example index 0a9d99796da68c294f59c9b4437917eb6d035fe2..3bd95c7c2d620390bd32cb180ed1f84037d856dc 100644 --- a/.env.example +++ b/.env.example @@ -11,3 +11,4 @@ MAIL_FROM_NAME="Getränkekasse" MAIL_TLS=true MAIL_AUTH_METHOD="plain" MAIL_REPLY_TO="getraenke@domain.tld" # optional, sets the reply-to header, useful if you don't read the mailbox of MAIL_USER +MAIL_SUBJECT_PREFIX="[Getränkekasse] " diff --git a/docker-compose.yml.example b/docker-compose.yml.example index b80af6026e3a4c9acd6064db5e2d92d446c723a6..032ba1440e5667a05741f5e78290439ddc3d6a74 100644 --- a/docker-compose.yml.example +++ b/docker-compose.yml.example @@ -38,6 +38,7 @@ services: MAIL_TLS: ${MAIL_TLS} MAIL_AUTH_METHOD: ${MAIL_AUTH_METHOD} MAIL_REPLY_TO: ${MAIL_REPLY_TO} + MAIL_SUBJECT_PREFIX: ${MAIL_SUBJECT_PREFIX} volumes: - ./article-images:/app/article-images diff --git a/src/lib/server/mail.js b/src/lib/server/mail.js index a1af296bc4ccd2b376a276bdbf0c474296d8e6c8..716043d30a10baaaa6b381755c6d68a4fd4ab684 100644 --- a/src/lib/server/mail.js +++ b/src/lib/server/mail.js @@ -21,8 +21,9 @@ const transporter = nodemailer.createTransport({ */ export async function sendMail({to, subject, text, html=false}) { const content = html ? {html: text} : {text}; + const subjectPrefix = process.env.MAIL_SUBJECT_PREFIX ?? ""; return transporter.sendMail({ - subject, + subject: subjectPrefix + subject, to, from: { address: process.env.MAIL_FROM_ADDRESS,