sklarsa / django-sendgrid-v5

An implementation of Django's EmailBackend compatible with sendgrid-python v5+
MIT License
318 stars 54 forks source link

How to add personalization #87

Closed jyothisgm closed 3 years ago

jyothisgm commented 3 years ago

I am unable to add Personalizations through EmailMessage. Please can you post an example on using it like https://docs.sendgrid.com/for-developers/sending-email/personalizations#sending-a-single-email-to-a-single-recipient-with-multiple-ccs-and-bccs

sklarsa commented 3 years ago

It depends on the specific Personalization that you want to use. We have some code examples in the README that you can check out. Is there a missing Personalization feature that this repo doesn't currently support?

jyothisgm commented 3 years ago

Hi, I am trying to have different subject line for different users. Like the below json. I am unable to figure out how to do it using EmailMessageclass

"personalizations": [
    {
      "subject": "YOUR SUBJECT LINE GOES HERE",
      "to": [
        {
          "email": "recipient1@example1.com"
        }
      ],
      "from": {
        "email": "sender1@samedomain.com"
      }
    },
    {
      "subject": "YOUR SUBJECT LINE GOES HERE",
      "to": [
        {
          "email": "recipient2@example2.com"
        }
      ],
      "from": {
        "email": "sender2@samedomain.com"
      }
    },
    {
      "subject": "YOUR SUBJECT LINE GOES HERE",
      "to": [
        {
          "email": "recipient3@example3.com"
        }
      ],
      "from": {
        "email": "sender3@samedomain.com"
      }
    }
  ]
sklarsa commented 3 years ago

Ah I see. We don't support multiple Personalizations right now, but that's something we can add to a future release. I'll open up a milestone for v1.1 and add this ticket to it.

jyothisgm commented 3 years ago

Thank You.

stale[bot] commented 3 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

sklarsa commented 3 years ago

bump

sklarsa commented 3 years ago

@jyothisgm does this PR address your issue?

jyothisgm commented 3 years ago

From what I understand , this is exactly what I am looking for. I home it works as intended as well. Thanks.

sklarsa commented 3 years ago

Close by #93