Skip to content

fix: personalize the team invitation email#1747

Merged
nevo-david merged 1 commit into
mainfrom
fix/team-invite-email-copy
Jul 23, 2026
Merged

fix: personalize the team invitation email#1747
nevo-david merged 1 commit into
mainfrom
fix/team-invite-email-copy

Conversation

@giladresisi

Copy link
Copy Markdown
Collaborator

What kind of change does this PR introduce?

Bug fix (email deliverability).

Why was this change needed?

Team invitation emails were landing in Gmail spam. The email was maximally generic — subject "You have been invited to join an organization", a bare "click here" link, no org or inviter name — which is exactly the shape spam filters penalize.

The invite now names the inviter and the team in the subject and body, with a descriptive link text: subject becomes "Gilad invited you to join "Resisi"", body "Gilad (gilad@postiz.com) has invited you to join the "Resisi" team. Accept the invitation to get started." Only the email content changed; the invite link and flow are untouched.

Repro and verification: an invitation sent to a Gmail test account landed in spam, even though earlier Postiz emails had reached that inbox. After this change, the same invitation to the same account landed in the regular inbox.

Other information:

Independent of the open #1745/#1746 stack.

Checklist:

  • I have read the CONTRIBUTING guide.
  • I have signed the Contributor License Agreement (CLA) (ICLA for individuals, CCLA for entities).
  • I confirm I have not used AI to submit this PR or generate code for it.
  • I checked that there were no similar issues or PRs already open for this.
  • This PR fixes just ONE issue

🤖 Generated with Claude Code

The invite email was maximally generic - 'You have been invited to
join an organization', a bare 'click here' link, no org or inviter
name - which is exactly the shape spam filters penalize. Name the
inviter and the team in the subject and body and use a descriptive
link text instead.

Repro: an invitation sent to a Gmail test account landed in spam,
even though earlier Postiz emails had reached its regular inbox.
After this change the same invitation to the same account landed in
the regular inbox.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@postiz-contribution postiz-contribution Bot added the contribution:approved Approved contributor label Jul 19, 2026
@postiz-agent

postiz-agent Bot commented Jul 19, 2026

Copy link
Copy Markdown

Snyk checks have passed. No issues have been found so far.

Status Scan Engine Critical High Medium Low Total (0)
Open Source Security 0 0 0 0 0 issues
Licenses 0 0 0 0 0 issues
Code Security 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

Comment on lines +89 to +92
: user.email;
await this._notificationsService.sendEmail(
body.email,
'You have been invited to join an organization',
`You have been invited to join an organization. Click <a href="${url}">here</a> to join.<br />The link will expire in 2 days.`
`${user.name || user.email} invited you to join "${org.name}"`,

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: The organization name org.name is not escaped before being interpolated into an email's subject and HTML body, which can break email rendering.
Severity: MEDIUM

Suggested Fix

Apply HTML entity escaping to the org.name variable before it is used in the email subject and body. This will convert special characters (e.g., < to &lt;) and ensure they are displayed as text rather than being interpreted as HTML by the email client.

Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent. Verify if this is a real issue. If it is, propose a fix; if not, explain why it's
not valid.

Location:
libraries/nestjs-libraries/src/database/prisma/organizations/organization.service.ts#L89-L92

Potential issue: The organization name, `org.name`, is used to construct an email
invitation in `organization.service.ts`. This name is then interpolated directly into
both the email subject and the HTML body without any sanitization or escaping. If an
organization's name contains special HTML characters such as `<`, `>`, or `&`, it can
break the HTML structure of the email. This could lead to incorrect rendering or display
issues in the recipient's email client, potentially making the invitation unreadable.

Did we get this right? 👍 / 👎 to inform future reviews.

@nevo-david
nevo-david merged commit ce9c675 into main Jul 23, 2026
11 checks passed
@nevo-david
nevo-david deleted the fix/team-invite-email-copy branch July 23, 2026 03:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

contribution:approved Approved contributor

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants