I have a simple contact form that I’m trying to get to send email. I have a Sendgrid account and have followed the tutorial Sending Email. I get a warning: function MyApp.Email.contact_us_text_email/1 is undefined (module MyApp.Email is not available)
.
defmodule Email do
use Bamboo.Phoenix, view: RocfDev.EmailView
def contact_us_text_email(email) do
new_email
|> to(myemail@gmail.com)
|> from(email)
|> subject("From Contact Us")
|> text_body("Contact Us")
end
end
I then try to use it this way MyApp.Email.contact_us_text_email("fromemail@gmail.com") |> Mailer.deliver_now
.
Any pointers as to how to fix this or a solution will be most appreciated. PS (I have delibrately hardcoded the email address as a quick and dirty solution. Once it works I’ll refactor).