sendgrid-nodejs icon indicating copy to clipboard operation
sendgrid-nodejs copied to clipboard

fix: Changed contentId to content_id for correct type

Open YoussefHenna opened this issue 2 years ago • 5 comments

Fixes

In order for the 'Content-ID' header to be set for the attachment, the parameter 'content_id' has to be set. 'contentId' isn't registered as the header, and the header is not provided in the email. The only workaround is to not use types, which defeats the purpose.

This should fix the type

Checklist

  • [x] I acknowledge that all my contributions will be made under the project's license
  • [x] I have made a material change to the repo (functionality, testing, spelling, grammar)
  • [x] I have read the Contribution Guidelines and my PR follows them
  • [x] I have titled the PR appropriately
  • [x] I have updated my branch with the main branch
  • [ ] I have added tests that prove my fix is effective or that my feature works
  • [ ] I have added the necessary documentation about the functionality in the appropriate .md file
  • [ ] I have added inline documentation to the code I modified

If you have questions, please file a support ticket.

YoussefHenna avatar May 28 '22 19:05 YoussefHenna

Please merge.

itseramin avatar Nov 04 '22 18:11 itseramin

omg, really...

depyronick avatar Nov 25 '22 20:11 depyronick

if anyone needs a hand...

import { AttachmentData } from "@sendgrid/helpers/classes/attachment";

attachments: <(AttachmentData & { content_id: string })[]>[{
      disposition: 'inline',
      filename: 'image.jpg',
      content: base64Content,
      content_id: "inlineimage",
      type: 'image/jpeg'
}]

depyronick avatar Nov 25 '22 20:11 depyronick

Wow I just spent a good chunk of time trying to figure out why SendGrid wasn't setting the Content-ID header. This really should be merged ASAP @twilio-dx

davidchalifoux avatar Sep 14 '23 17:09 davidchalifoux

@SendGridDX: can we merge this. It's insane that the field is misnamed in the official node package.

tianhuil avatar Oct 28 '23 18:10 tianhuil