diff --git a/docker-compose.yml b/docker-compose.yml index e767fab0c..a0066a6c5 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -22,7 +22,6 @@ services: - CLASSIC_ELECTION_COUNT=0 - CLASSIC_VOTE_COUNT=0 - SENDGRID_API_KEY='SG.' - - SENDGRID_GROUP_ID='' - EMAIL_TEST_MODE=if defined will prevent emails from being sent from email service while testing - FROM_EMAIL_ADDRESS=elections@star.vote depends_on: diff --git a/packages/backend/sample.env b/packages/backend/sample.env index 9d2250d75..40b89634d 100644 --- a/packages/backend/sample.env +++ b/packages/backend/sample.env @@ -19,7 +19,6 @@ CLASSIC_VOTE_COUNT=0 #### EMAIL #### # Contact elections@equal.vote if you need access for developing email features SENDGRID_API_KEY='SG.' # including SG to remove the warning -SENDGRID_GROUP_ID='' EMAIL_TEST_MODE=if defined will prevent emails from being sent from email service while testing FROM_EMAIL_ADDRESS=elections@star.vote diff --git a/packages/backend/src/Services/Email/EmailTemplates.ts b/packages/backend/src/Services/Email/EmailTemplates.ts index 7e4fcce70..eeb7cd3b4 100644 --- a/packages/backend/src/Services/Email/EmailTemplates.ts +++ b/packages/backend/src/Services/Email/EmailTemplates.ts @@ -6,10 +6,11 @@ import { DateTime } from 'luxon' import { formatMarkdown, makeButton } from "@equal-vote/star-vote-shared/utils/formatMarkdown"; import sanitizeHtml from 'sanitize-html'; +// No asm group. Everything we send is transactional (ballot invites and +// receipts), and tagging a message with an unsubscribe group makes SendGrid +// add List-Unsubscribe headers plus an unsubscribe footer to the html and +// plain text parts. const emailSettings: Partial = { - asm: process.env.SENDGRID_GROUP_ID ? { - groupId: parseInt(process.env.SENDGRID_GROUP_ID) - } : undefined, mail_settings: process.env.EMAIL_TEST_MODE ? { "sandbox_mode": { "enable": true @@ -114,7 +115,7 @@ function emailTemplate(content: string) { // 1. Edit template within the STAR Voting mailchimp account // 2. Export template as html // 3. substitute EMAIL_CONTENT with ${content} - // 4. substitute UNSUBSCRIBE_LINK with <%asm_group_unsubscribe_url%> + // 4. delete the UNSUBSCRIBE_LINK block, see the note on emailSettings above // 5. delete MC_PREVIEW_TEXT block (3 lines) return `

${content}

+

${content}

diff --git a/packages/backend/src/Services/Email/IEmail.ts b/packages/backend/src/Services/Email/IEmail.ts index 1ffe5bb64..1a8a13a15 100644 --- a/packages/backend/src/Services/Email/IEmail.ts +++ b/packages/backend/src/Services/Email/IEmail.ts @@ -4,7 +4,6 @@ export interface Imsg { subject: string, text: string, html: string, - asm?: {groupId: number} mail_settings?: { sandbox_mode?: { enable: boolean