script
November 5, 2018, 11:00am
#1
I am using this library written by @alexgaribay . I have setup the api key in the config . Using the SendGrid Emai and Mailer to send the email .
Email.build()
|> Email.add_to("email")
|> Email.put_from("email")
|> Email.put_subject("Hello from Elixir")
|> Email.put_text("Sent with Elixir")
|> Mailer.send()
This returns :ok
. But I am not receiving email in the email address I write in the above Email.add_to
. Am I doing some thing wrong?
0x6a68
November 5, 2018, 11:24am
#2
Have you checked your Spam Folder?
script
November 5, 2018, 11:25am
#3
yes.
And also use different emails. Get :ok from the SendGrid but no email.
We are using send grid as well. If nothing else helps you can try this piece of code to send a mail and look if it works: https://gist.github.com/mlankenau/91d450f6ad9edb3cbadbd9aa746b176f
Just to exclude the possibility that there is an issue in the lib.
You have to set SEND_GRID_API_KEY in your env.
1 Like
If :ok
is being returned, then SendGrid is saying that it’s a valid request. Do you by chance have the sandbox_enabled
flag as true
in your config? That would be the only way you’d get :ok
without the email being sent.
2 Likes
script
November 6, 2018, 5:00am
#6
Thanks alex for your reply. It seems to work fine after deleting deps folder and running mix.deps again.