hendri-tobing
Function MyWeb.Bamboo.SentEmailViewerPlug.init/1 is undefined
I am working on an umbrella application that contains a separate Phoenix and Ecto application (my_web and my_app).
Then I Install the Bamboo email library for sending emails on the Phoenix App my_web. Bamboo can view the sent emails by using the Phoenix controller. I follow the configuration as described in the documentation.
# in config file (config/config.exs)
config: my_web, MyWeb.Mailer,
adapter: Bamboo.LocalAdapter
# In Router
defmodule MyWeb.Router do
if Mix.env ==: dev do
# If using Phoenix
forward "/ sent_emails", Bamboo.SentEmailViewerPlug
end
end
However, there is an error message:
MyWeb.Bamboo.SentEmailViewerPlug.init / 1 function is undefined
It is wrong because the correct one is Bamboo.SentEmailViewerPlug module, not MyWeb.Bamboo.SentEmailViewerPlug.
Any ideas to resolve this are appreciated.
Thank you.
Marked As Solved
jg-made
Just take it out of the scope. Move those 3 lines in your router.ex:
if Mix.env == :dev do
forward "/sent_emails", Bamboo.SentEmailViewerPlug
end
down one line (after the scope’s end) and I think it should be fine.
Also Liked
hendri-tobing
Thank you. This is the solution.
Thank you also for all the responses.
Popular in Questions
Other popular topics
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #websockets
- #supervisor
- #advent-of-code
- #elixirconf-us
- #distillery
- #processes
- #forms
- #api
- #metaprogramming
- #security
- #performance








