Skip to content
Snippets Groups Projects
Commit 6698107d authored by Aaron Dötsch's avatar Aaron Dötsch
Browse files

Add MAIL_SUBJECT_PREFIX env variable

parent d26473c5
No related branches found
No related tags found
No related merge requests found
......@@ -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] "
......@@ -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
......
......@@ -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,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment