Skip to content

Inline images aren't displaying inline #57

Description

@brentkearney

Hi, thanks so much for your work on sparkpost_rails!

I'm trying to include inline images like this:

message[:attachments].each do |ad|
  attachments.inline[ad.original_filename] = {
     mime_type: ad.content_type,
     content: File.read(ad.tempfile),
     cid: 'some-name'
  }
end

However, the message arrives with a randomly generated Content-Id rather than the specified cid: parameter, and a missing image icon appears where the <img> tag is in HTML, with the attachment at the bottom of the message.

In this case, the email is received from Sparkpost webhook, so the content-id is already set in the incoming email. I parse it out, and then use that value in the cid: parameter in attachments.inline[] = {}. If it were actually used, the image would display inline where specified by the <img> tag, but the cid parameter seems to be ignored.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions