Skip to content

Substitutions not working #1361

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
bramvbilsen opened this issue May 6, 2022 · 1 comment
Open

Substitutions not working #1361

bramvbilsen opened this issue May 6, 2022 · 1 comment

Comments

@bramvbilsen
Copy link

Issue Summary

Subsitution tags specified in the personalizations array are not being substituted using sendMultiple. Also, only the first object of personalizations is used, resulting in only a single email being sent instead of multiple.

Steps to Reproduce

  1. Send an email using sendMultiple including substitutions for each element in the personalizations field.
  2. Look at received email, the substitution tags are not replaced

Code Snippet

sendgrid.sendMultiple({
    personalizations: [
        {
            to: {
                email: "[email protected]",
                name: "John1",
            },
            substitutions: {
                "-name-": "John1",
            },
        },
        {
            to: {
                email: "[email protected]",
                name: "Bob",
            },
            substitutions: {
                "-name-": "Bob",
            },
        },
    ],
    from: {
        email: "[email protected]",
    },
    subject: "Welcome!",
    text: "Hi there -name- 👋",
});

Technical details:

  • sendgrid-nodejs version: ^7.6.2
  • node version: v16.13.2
@dcerge
Copy link

dcerge commented May 19, 2025

I support this issue - substitutions are not working in the text content while they work in the html content. When both types of content are present then it depends on what email app recipients use. Mac's Mail app by default shows only text content when both text and html content is present. As substitutions are not working in text content then it seems that they do not work at all. If a user uses another email app like Gmail, then they see only html content even if text content is present. As in the HTML content substitutions are working so they may not understand what the problem is with not working substitutions.

Please fix the issue with substitutions in text content or at least update your documentation so users know about this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants