I was try to use crontab to schedule my simple mix task that send emails, the task works perfect by run
mix hello.greeting but does not work (scheduled, but no email sent ) if i put something like this in crontab
*/5 * * * * cd path/to/myapp; /usr/local/bin/mix hello.greeting
my simple task code
defmodule Mix.Tasks.Hello.Greeting do use Mix.Task alias Hwapp.Email alias Hwapp.Mailer @shortdoc "Sends a greeting to us from Hello Phoenix" @moduledoc """ This is where we would put any long form documentation or doctests. """ def run(_args) do Mix.shell.info("Greetings from the Hello Phoenix Application!") Mix.Task.run "app.start" # get all users "hello@localhost" Email.welcome_html_email() |> Mailer.deliver_now end) end end
Thanks for your time.