Module not found

  use Bamboo.Phoenix, view: TevetaWeb.EmailView
  alias Teveta.Mailer
  import Bamboo.Email

  def welcome_text_email(email_address) do
    new_email
    |> to(email_address)
    |> from("us@example.com")
    |> subject("Welcome!")
    |> text_body("Welcome to MyApp!")
  end
end

and my mailer definition is: 


defmodule Teveta.Mailer do
  use Bamboo.Mailer, otp_app: :teveta
end


but am getting this error!
(UndefinedFunctionError) function Mailer.deliver_now/1 is undefined (module Mailer is not available)

Can you please put your code in triple quotes ```

I think you should call it as Teveta.Mailer.deliver_now instead of Mailer.deliver_now

I think @hudsonbay is right. You are basically using alias Teveta.Mailer however that will only apply inside that module (and on lines after alias). So I assume the place you call Mailer.xxx you have not aliased the module there

1 Like

Hi @chips I can’t see in your example of code where are you calling deliver_now/1?

it has been answered Already

Great :+1: