diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 4145f5b7dc4f3a253a1083e210451d2fa991e288..8ac72cee87fcdfdd5dba6b688aaf3ec0b72d3dfa 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -43,6 +43,7 @@ deploy_development: - export RABBITMQ_LISTENING_PORT=5672 - export RABBITMQ_GUI_PORT=15672 - export MAIL_SUBJECT_PREFIX=alpha + - export NO_REPLY_MAIL_ADDRESS=no-reply@erasme.org - docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY - docker-compose pull - docker-compose --project-name service-email-${TAG} up -d --force-recreate @@ -60,6 +61,7 @@ deploy_staging: - export RABBITMQ_LISTENING_PORT=5673 - export RABBITMQ_GUI_PORT=15673 - export MAIL_SUBJECT_PREFIX=alpha + - export NO_REPLY_MAIL_ADDRESS=no-reply@erasme.org - docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY - TAG=dev docker-compose pull - docker tag $CI_REGISTRY/refonte-data/service-email:dev $CI_REGISTRY/refonte-data/service-email:${TAG} diff --git a/docker-compose.yml b/docker-compose.yml index 8d66098545f603a04cf4e4a4757f4e71137023d9..978d0694e1a3d7a4e6c35fe22c85f10fa802cd26 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -14,6 +14,7 @@ services: - GROUP_HEADER=x-consumer-groups - EMAIL_WRITER_GROUP_NAME=email-writer - MAIL_SUBJECT_PREFIX=${MAIL_SUBJECT_PREFIX} + - NO_REPLY_MAIL_ADDRESS=${NO_REPLY_MAIL_ADDRESS} restart: unless-stopped rabbitmq: diff --git a/src/configuration/config.service.ts b/src/configuration/config.service.ts index 2b12b4a831d98997c3ce752b4b280e3d2e164048..80c8f4bcc8d34d56e1d2e5994164374054f35113 100644 --- a/src/configuration/config.service.ts +++ b/src/configuration/config.service.ts @@ -24,6 +24,7 @@ export class ConfigService { this._config.groupNames.emailWriter = process.env.EMAIL_WRITER_GROUP_NAME; this._config.groupHeader = process.env.GROUP_HEADER; this._config.mailSubjectPrefix = process.env.MAIL_SUBJECT_PREFIX; + this._config.noReplyMailAddress = process.env.NO_REPLY_MAIL_ADDRESS; } get config() { diff --git a/src/configuration/config.ts b/src/configuration/config.ts index dc11d00f1f42f300d5eb6738881a569167ca41c8..b842d19ff8f221333e64e40ab9f15e7660be3d74 100644 --- a/src/configuration/config.ts +++ b/src/configuration/config.ts @@ -13,4 +13,5 @@ export const config = { }, groupHeader: '', mailSubjectPrefix: '', + noReplyMailAddress: '', }; \ No newline at end of file diff --git a/src/configuration/template.env b/src/configuration/template.env index 6621c6de093ffeb1da12f605ddf12674091b57f5..06f4d17b46e29857e72036190e99eb03ccd38644 100644 --- a/src/configuration/template.env +++ b/src/configuration/template.env @@ -1,4 +1,5 @@ RABBITMQ_USER= RABBITMQ_PASSWORD= USER_SUPPORT_MAILBOX= -MAIL_SUBJECT_PREFIX= \ No newline at end of file +MAIL_SUBJECT_PREFIX= +NO_REPLY_MAIL_ADDRESS= \ No newline at end of file diff --git a/src/email/email.service.ts b/src/email/email.service.ts index ae8cb1c6defd70299321b6915637c8970e7de5c9..ff428f1670b32dce74dfd54ddc40930476680a25 100644 --- a/src/email/email.service.ts +++ b/src/email/email.service.ts @@ -43,6 +43,7 @@ export class EmailService { const userEmail = new EmailWithoutFrom(); userEmail.to = [contactForm.email]; + adminEmail.replyTo = this.config.userSupportMailbox; userEmail.subject = contactForm.subject; userEmail.html = userEmailBody; @@ -89,10 +90,10 @@ export class EmailService { const mailerQueue = this.config.mailerQueue; let email = new Email(); - email.from = this.config.userSupportMailbox; + email.from = this.config.noReplyMailAddress; email = Object.assign(email, emailInfo); - if (this.config.emailSubjectPrefix) { + if (this.config.mailSubjectPrefix) { email.subject = `[${this.config.mailSubjectPrefix}] ${email.subject}`; }