Skip to content

The content_id parameter is required if disposition = \'inline\'.' #841

Open
@dungahk

Description

@dungahk

Issue Summary

Error when trying to send an email with an attachment.

The content_id parameter is required if disposition = \'inline\'.',

Steps to Reproduce

Just try to send an email with attachments and disposition 'inline'.

My code:

send({
  from: { name: 'From Name', email: '[email protected]' },
  to: { name: 'To Name', email: '[email protected]' },
  subject: `Some subject`,
  text: 'Email text',
  attachments: [
    {
      content: buffers.pop().toString('base64'),
      filename: fileMetadata.name.split('/').pop(),
      type: fileMetadata.contentType,
      disposition: 'inline',
      contentId: 'my_content_id'
    }
  ]
});

I'm using Typescript and the attachments property is defined as an Array of AttachmentData, which includes a property called contentId, but the API requires the property content_id which is in the interface AttachmentJSON instead.

send function types: https://github.com/sendgrid/sendgrid-nodejs/blob/master/packages/mail/src/mail.d.ts#L20

attachments property types: https://github.com/sendgrid/sendgrid-nodejs/blob/master/packages/helpers/classes/mail.d.ts#L134

AttachmentData interface types: https://github.com/sendgrid/sendgrid-nodejs/blob/master/packages/helpers/classes/attachment.d.ts#L1

Technical details:

  • @sendgrid/mail Version: 6.3.1
  • Node.js Version: 8.11.2
  • TypeScript Version: 3.1.6

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions