Mailtrap.Email.Attachment (mailtrap v0.1.2)

Attachment struct

Link to this section Summary

Functions

Builds Attachment struct

Puts content_id to the attachment struct.

Puts disposition to the attachment struct.

Puts type to the attachment struct

Link to this section Types

@type t() :: %Mailtrap.Email.Attachment{
  content: String.t(),
  content_id: String.t() | nil,
  disposition: String.t() | nil,
  filename: String.t(),
  type: String.t() | nil
}

Link to this section Functions

Link to this function

build(content, filename)

@spec build(binary(), String.t()) :: t()

Builds Attachment struct

Link to this function

put_content_id(attachment, content_id)

@spec put_content_id(t(), String.t()) :: t()

Puts content_id to the attachment struct.

examples

Examples

iex> attachment = Mailtrap.Email.Attachment.build("content", "filename") iex> Mailtrap.Email.Attachment.put_content_id(attachment, "abcdef") %Mailtrap.Email.Attachment{

content_id: "abcdef",
filename: "filename",
content: "Y29udGVudA=="

}

Link to this function

put_disposition(attachment, disposition)

@spec put_disposition(t(), String.t()) :: t()

Puts disposition to the attachment struct.

examples

Examples

iex> attachment = Mailtrap.Email.Attachment.build("content", "filename") iex> Mailtrap.Email.Attachment.put_disposition(attachment, "inline") %Mailtrap.Email.Attachment{

disposition: "inline",
filename: "filename",
content: "Y29udGVudA=="

}

Link to this function

put_type(attachment, type)

@spec put_type(t(), String.t()) :: t()

Puts type to the attachment struct

examples

Examples

iex> attachment = Mailtrap.Email.Attachment.build("content", "filename") iex> Mailtrap.Email.Attachment.put_type(attachment, "text/plain") %Mailtrap.Email.Attachment{

type: "text/plain",
filename: "filename",
content: "Y29udGVudA=="

}