Poodle.Client (poodle v1.0.0)

View Source

Main client for the Poodle SDK.

Provides high-level functions for sending emails through the Poodle API.

Summary

Functions

Send an email with both HTML and text content.

Send an email asynchronously.

Send an email using an Email struct.

Send an email using an Email struct asynchronously.

Send an HTML email asynchronously.

Send a plain text email asynchronously.

Functions

send(from, to, subject, opts \\ [])

@spec send(String.t(), String.t(), String.t(), keyword()) ::
  {:ok, Poodle.Response.t()} | {:error, Poodle.Error.t()}

Send an email with both HTML and text content.

Examples

iex> Poodle.Client.send("from@example.com", "to@example.com", "Subject", html: "<h1>Hello</h1>", text: "Hello")
{:ok, %Poodle.Response{...}}

send_async(from, to, subject, opts \\ [])

@spec send_async(String.t(), String.t(), String.t(), keyword()) :: Task.t()

Send an email asynchronously.

Returns a Task that can be awaited for the result.

Examples

iex> task = Poodle.Client.send_async("from@example.com", "to@example.com", "Subject", html: "<h1>Hello</h1>")
iex> Task.await(task)
{:ok, %Poodle.Response{...}}

send_email(email, config \\ nil, opts \\ [])

@spec send_email(Poodle.Email.t(), Poodle.Config.t() | nil, keyword()) ::
  {:ok, Poodle.Response.t()} | {:error, Poodle.Error.t()}

Send an email using an Email struct.

Examples

iex> email = %Poodle.Email{from: "from@example.com", to: "to@example.com", subject: "Subject", html: "<h1>Hello</h1>"}
iex> Poodle.Client.send_email(email)
{:ok, %Poodle.Response{...}}

send_email_async(email, config \\ nil, opts \\ [])

@spec send_email_async(Poodle.Email.t(), Poodle.Config.t() | nil, keyword()) ::
  Task.t()

Send an email using an Email struct asynchronously.

Examples

iex> email = %Poodle.Email{from: "from@example.com", to: "to@example.com", subject: "Subject", html: "<h1>Hello</h1>"}
iex> task = Poodle.Client.send_email_async(email)
iex> Task.await(task)
{:ok, %Poodle.Response{...}}

send_html(from, to, subject, html, opts \\ [])

@spec send_html(String.t(), String.t(), String.t(), String.t(), keyword()) ::
  {:ok, Poodle.Response.t()} | {:error, Poodle.Error.t()}

Send an HTML email.

Examples

iex> Poodle.Client.send_html("from@example.com", "to@example.com", "Subject", "<h1>Hello</h1>")
{:ok, %Poodle.Response{...}}

send_html_async(from, to, subject, html, opts \\ [])

@spec send_html_async(String.t(), String.t(), String.t(), String.t(), keyword()) ::
  Task.t()

Send an HTML email asynchronously.

Examples

iex> task = Poodle.Client.send_html_async("from@example.com", "to@example.com", "Subject", "<h1>Hello</h1>")
iex> Task.await(task)
{:ok, %Poodle.Response{...}}

send_text(from, to, subject, text, opts \\ [])

@spec send_text(String.t(), String.t(), String.t(), String.t(), keyword()) ::
  {:ok, Poodle.Response.t()} | {:error, Poodle.Error.t()}

Send a plain text email.

Examples

iex> Poodle.Client.send_text("from@example.com", "to@example.com", "Subject", "Hello")
{:ok, %Poodle.Response{...}}

send_text_async(from, to, subject, text, opts \\ [])

@spec send_text_async(String.t(), String.t(), String.t(), String.t(), keyword()) ::
  Task.t()

Send a plain text email asynchronously.

Examples

iex> task = Poodle.Client.send_text_async("from@example.com", "to@example.com", "Subject", "Hello")
iex> Task.await(task)
{:ok, %Poodle.Response{...}}