Poodle.Email (poodle v1.0.0)
View SourceEmail struct and validation for the Poodle SDK.
Summary
Functions
Create a new email struct.
Create a new email struct, raising on error.
Convert email struct to a map for API requests.
Validate an email struct.
Types
Functions
Create a new email struct.
Examples
iex> Poodle.Email.new("from@example.com", "to@example.com", "Subject", html: "<h1>Hello</h1>")
{:ok, %Poodle.Email{...}}
iex> Poodle.Email.new("invalid-email", "to@example.com", "Subject")
{:error, "Invalid from email address"}
Create a new email struct, raising on error.
Examples
iex> Poodle.Email.new!("from@example.com", "to@example.com", "Subject", html: "<h1>Hello</h1>")
%Poodle.Email{...}
Convert email struct to a map for API requests.
Examples
iex> email = %Poodle.Email{from: "from@example.com", to: "to@example.com", subject: "Test", html: "<h1>Hello</h1>"}
iex> Poodle.Email.to_map(email)
%{from: "from@example.com", to: "to@example.com", subject: "Test", html: "<h1>Hello</h1>"}
Validate an email struct.
Examples
iex> email = %Poodle.Email{from: "from@example.com", to: "to@example.com", subject: "Test", html: "<h1>Hello</h1>"}
iex> Poodle.Email.validate(email)
:ok