MatOsinski

MatOsinski

Bamboo SentEmailViewerPlug undefined

I do have an issue with mentioned function. This is the error from browser:

function Bamboo.SentEmailViewerPlug.init/1 is undefined (module Bamboo.SentEmailViewerPlug is not available)

And this is from console :

[error] #PID<0.868.0> running RewardappWeb.Endpoint (connection #PID<0.829.0>, stream id 4) terminated
Server: localhost:4000 (http)
Request: GET /mailbox
** (exit) an exception was raised:
    ** (UndefinedFunctionError) function Bamboo.SentEmailViewerPlug.init/1 is undefined (module Bamboo.SentEmailViewerPlug is not available)
        Bamboo.SentEmailViewerPlug.init([])
        (phoenix 1.6.6) lib/phoenix/router/route.ex:41: Phoenix.Router.Route.call/2
        (phoenix 1.6.6) lib/phoenix/router.ex:355: Phoenix.Router.__call__/2
        (rewardapp 0.1.0) lib/rewardapp_web/endpoint.ex:1: RewardappWeb.Endpoint.plug_builder_call/2
        (rewardapp 0.1.0) lib/plug/debugger.ex:136: RewardappWeb.Endpoint."call (overridable 3)"/2
        (rewardapp 0.1.0) lib/rewardapp_web/endpoint.ex:1: RewardappWeb.Endpoint.call/2
        (phoenix 1.6.6) lib/phoenix/endpoint/cowboy2_handler.ex:54: Phoenix.Endpoint.Cowboy2Handler.init/4
        (cowboy 2.9.0) /Users/mateuszosinski/Desktop/elixir/rewardapp/deps/cowboy/src/cowboy_handler.erl:37: :cowboy_handler.execute/2
        (cowboy 2.9.0) /Users/mateuszosinski/Desktop/elixir/rewardapp/deps/cowboy/src/cowboy_stream_h.erl:306: :cowboy_stream_h.execute/3
        (cowboy 2.9.0) /Users/mateuszosinski/Desktop/elixir/rewardapp/deps/cowboy/src/cowboy_stream_h.erl:295: :cowboy_stream_h.request_process/3
        (stdlib 3.17.1) proc_lib.erl:226: :proc_lib.init_p_do_apply/3

Here is my router.ex file :

defmodule RewardappWeb.Router do
  use RewardappWeb, :router
  use Phoenix.Router

  pipeline :browser do
    plug :accepts, ["html"]
    plug :fetch_session
    plug :fetch_live_flash
    plug :put_root_layout, {RewardappWeb.LayoutView, :root}
    plug :protect_from_forgery
    plug :put_secure_browser_headers
  end

  pipeline :api do
    plug :accepts, ["json"]
  end

  scope "/", RewardappWeb do
    pipe_through :browser


    #get "/", PageController, :index
    #NEW ROUTES
    #get "/users", GrantController, :login
    get "/admin", GrantController, :admin
    get "/main", GrantController, :main
    get "/", GrantController, :index
    post "/", GrantController, :login
    get "/add", GrantController, :add
    post "/add/:id", GrantController, :update
    get "/admin/delete/:id", GrantController, :delete

  end

  if Mix.env == :dev do
    forward "/mailbox", Bamboo.SentEmailViewerPlug
  end

  # Other scopes may use custom stacks.
  # scope "/api", RewardappWeb do
  #   pipe_through :api
  # end

  # Enables LiveDashboard only for development
  #
  # If you want to use the LiveDashboard in production, you should put
  # it behind authentication and allow only admins to access it.
  # If your application does not have an admins-only section yet,
  # you can use Plug.BasicAuth to set up some basic authentication
  # as long as you are also using SSL (which you should anyway).
  if Mix.env() in [:dev, :test] do
    import Phoenix.LiveDashboard.Router

    scope "/" do
      pipe_through :browser

      live_dashboard "/dashboard", metrics: RewardappWeb.Telemetry
    end
  end

  # Enables the Swoosh mailbox preview in development.
  #
  # Note that preview only shows emails that were sent by the same
  # node running the Phoenix server.
  if Mix.env() == :dev do
    scope "/dev" do
      pipe_through :browser

      #forward "/mailbox", Plug.Swoosh.MailboxPreview
    end
  end
end

Mails are being sent totally fine - I have inspected that with IO.inspect, and right now, they are sent fine. However, I can not attempt to see localhost:4000/mailbox. Where is my mistake? Thank you in advance!!

Marked As Solved

MatOsinski

MatOsinski

The solution is Bamboo.EmailPreviewPlug instead of Bamboo.SentEmailViewerPlug.

Where Next?

Popular in Questions Top

marius95
Hello everyone, I try to use an Javascript Event Handler in my root.html.leex file. Therefore I created a function in the app.js file: ...
New
New
senggen
Erlang/OTP 25 [erts-13.2.2] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] 15:22:35.803 [error] gen_event {lager_file_backend...
New
JulienCorb
I am trying to implement my new.html.eex file to create new posts on my website. new.html.eex: &lt;h1&gt;Create Post&lt;/h1&gt; &lt;%= ...
New
freewebwithme
Using vs code and installed ElixirLS: support and debugger. And I got an error popped up on start up says Failed to run ‘elixir’ comma...
New
sergio_101
I am VERY much an elixir newbie. I have taken one elixir course and one phoenix course on Udemy. During that course, I saw the instructor...
New
fayddelight
I tried installing elixir 1.11.2 erlang 23.3.4 via asdf in my zsh shell. Enabled the versions locally and globally. When I list them ...
New
ashish173
I am using Ecto timestamps with postgres, I can see the timestamps() use the :naive_dateime but for my use case I wanted to store the ti...
New
hariharasudhan94
I would like to know what is the best IDE for elixir development?
New
vonH
In asking this question I am more interested about the expressiveness of the language itself and less concerned about the availability of...
New

Other popular topics Top

albydarned
Hello all! I am typing this post from my new MacBook Pro with the M1 chip. I’m loving it so far, and will probably use it as my daily dr...
New
electic
Hi, I am new to Elixir. I am trying to use the DateTime component to insert a date into MySQL however the there seems to be no way to fo...
New
shahryarjb
Hello, I have map which I want to convert it to string like this: the map: %{last_name: "tavakkoli", name: "shahryar"} the string I ne...
New
chrismccord
Phoenix 1.4.0 released Phoenix 1.4 is out! This release ships with exciting new features, most notably with HTTP2 support, improved deve...
688 30877 112
New
AngeloChecked
What learn first? Rust or Elixir Hi Elixir community! I’m here because i want learn a new language. I’m a junior developer and mainly i ...
New
aalberti333
As the title describes, I’m trying to run Enum.map() over a list of key/value pairs, where the value is a map. My data looks like this: ...
New
sergio_101
I am VERY much an elixir newbie. I have taken one elixir course and one phoenix course on Udemy. During that course, I saw the instructor...
New
dogweather
I wrote this comment on r/haskell, and it’s not popular there. :wink: But I think I’m on to something… Haskell reminds me of Java, and e...
New
sergio
Kind of like when jquery came out, it was super necessary. Existing drag and drop libraries have a bunch of baggage to support old browse...
New
lanycrost
Hi everyone! I need implement if…else if…else condition from my elixir code, and anymore of this control flow structures not work proper...
New

We're in Beta

About us Mission Statement