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.
source: https://hexdocs.pm/bamboo/Bamboo.SentEmailViewerPlug.html
Also Liked
hendri-tobing
Thank you. This is the solution.
Thank you also for all the responses.







