Bamboo.Attachment (bamboo v2.2.0) View Source

Link to this section Summary


Creates a new Attachment

Link to this section Types


t() :: %Bamboo.Attachment{
  content_id: nil | String.t(),
  content_type: nil | String.t(),
  data: nil | binary(),
  filename: nil | String.t(),
  path: nil | String.t()

Link to this section Functions

Creates a new Attachment

content_id can be used to embed an image, attach it and reference it in the message body by setting its CID (Content-ID) and using a standard HTML tag:

<img src="cid:some-image-cid" alt="img" />

within an HTML email message.

Examples:"/path/to/attachment.png")"/path/to/attachment.png", filename: "image.png")"/path/to/attachment.png", filename: "image.png", content_type: "image/png", content_id: "12387432")["file"]) # Where params["file"] is a %Plug.Upload

|> put_html_layout({LayoutView, "email.html"})
|> put_attachment(%Bamboo.Attachment{content_type: "image/png", filename: "logo.png", data: "content", content_id: "2343333333"})