Skip to content
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

Support Custom content_id for Attachments in multipart/form-data #505

Closed
KJambo opened this issue Nov 26, 2024 · 2 comments
Closed

Support Custom content_id for Attachments in multipart/form-data #505

KJambo opened this issue Nov 26, 2024 · 2 comments

Comments

@KJambo
Copy link

KJambo commented Nov 26, 2024

Currently, the Nylas Ruby SDK does not allow users to set a custom content_id for attachments when sending emails as multipart/form-data. This limitation makes it difficult to use inline attachments, such as embedding images directly in the email body (e.g., <img src="cid:custom_content_id" />).

In the current implementation, the SDK automatically assigns attachment names like file0, file1, etc., when constructing the form request(source). While these names are internally treated as content_id by the Nylas API and can technically be used (e.g., <img src="cid:file0" />), users have no control over these identifiers. This lack of customization limits the flexibility and usability of inline attachments.

I would like the SDK to support user-defined content_id for attachments. Specifically:

  • Allow developers to specify a content_id for each attachment when constructing the email.
  • Use the provided content_id in place of the default names (file0, file1, etc.).
  • If no content_id is provided, fallback to the current behavior to ensure backward compatibility.
@KJambo
Copy link
Author

KJambo commented Nov 26, 2024

It seems that the method at file_utils.rb#L90 changes the attachment handling between JSON and form-based approaches depending on the attachment size. As a result, the way content_id is referenced also changes. This behavior seems inconsistent and might be a bug

This was referenced Nov 29, 2024
@SubashPradhan
Copy link
Contributor

The fix has been released in v6.2.2. Thanks for raising this issue.

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

No branches or pull requests

2 participants