Mailtrap.Sandbox (mailtrap v0.1.2)

Mailtrap Sandbox API client

example

Example

= File.read(Path.join(DIR, "test/support/invoice.pdf")) attachment = Mailtrap.Email.Attachment.build(data, "invoice1.pdf") %Mailtrap.Email{} |> Mailtrap.Email.put_from("Sender", "sender@example.com") |> Mailtrap.Email.put_to([{"Lolek", "lolek@example.com"}, {"Bolek", "bolek@example.com"}]) |> Mailtrap.Email.put_subject("Bla bla") |> Mailtrap.Email.put_text("Text bla bla") |> Mailtrap.Email.put_attachments([attachment]) |> Mailtrap.Sandbox.send(111) # 111 is inbox id

Link to this section Summary

Functions

Generates client

Sends an email to sandbox inbox

Link to this section Functions

@spec client(String.t()) :: Tesla.Client.t()

Generates client

Link to this function

send(client, email, inbox_id)

@spec send(Tesla.Client.t(), Mailtrap.Email.t(), integer()) ::
  {:ok, map()} | {:error, Tesla.Env.t()}

Sends an email to sandbox inbox