Haytni.Mail (Haytni v0.7.0) View Source

An intermediate to easily create a Bamboo email in a Phoenix way.

In fact, this module is similar to Bamboo.Phoenix but I encountered some limitations and troubles to deal with views/templates path.

Link to this section Summary

Functions

Sets an assign for the email. These will be available when rendering the email.

Same as put_text_template/2 but for rendering the email as HTML.

Sets the template for when rendering the email as plain text.

Stores the view for rendering the email.

Set and infer the full name of the view for email from module and its scope.

Link to this section Functions

Link to this function

assign(email, key, value)

View Source

Specs

assign(email :: Bamboo.Email.t(), key :: atom(), value :: any()) ::
  Bamboo.Email.t()

Sets an assign for the email. These will be available when rendering the email.

Link to this function

put_html_template(email, template)

View Source

Specs

put_html_template(email :: Bamboo.Email.t(), template :: String.t()) ::
  Bamboo.Email.t()

Same as put_text_template/2 but for rendering the email as HTML.

NOTE: the view (see put_view/2) has to be set prior to a call to put_html_template/2.

Link to this function

put_text_template(email, template)

View Source

Specs

put_text_template(email :: Bamboo.Email.t(), template :: String.t()) ::
  Bamboo.Email.t()

Sets the template for when rendering the email as plain text.

NOTE: the view (see put_view/2) has to be set prior to a call to put_text_template/2.

Specs

put_view(email :: Bamboo.Email.t(), view :: module()) :: Bamboo.Email.t()

Stores the view for rendering the email.

Link to this function

put_view(email, module, view_suffix)

View Source

Specs

put_view(
  email :: Bamboo.Email.t(),
  module :: module(),
  view_suffix :: atom() | String.t()
) :: Bamboo.Email.t()

Set and infer the full name of the view for email from module and its scope.

Example: if view_suffix = "Email.NewLoginNotification" and scope associated to module is :admin the view module is set to YourAppWeb.Admin.Email.NewLoginNotification if it exists else fallback to YourAppWeb.Email.NewLoginNotification.