diff options
author | Haelwenn (lanodan) Monnier <contact@hacktivis.me> | 2020-01-20 13:23:21 +0100 |
---|---|---|
committer | Haelwenn (lanodan) Monnier <contact@hacktivis.me> | 2020-01-28 16:49:38 +0100 |
commit | 4eb935be78eeaf1decb7fc109cec09ca18d82854 (patch) | |
tree | 4be2d8c3c0edce50783de984123c6a563affb018 /lib/mix/tasks/pleroma/email.ex | |
parent | b12f3064730648de992f934cf5a23cadb5206b9d (diff) | |
download | pleroma-4eb935be78eeaf1decb7fc109cec09ca18d82854.tar.gz |
Create pleroma.email mix task
Closes: https://git.pleroma.social/pleroma/pleroma/issues/1061
Diffstat (limited to 'lib/mix/tasks/pleroma/email.ex')
-rw-r--r-- | lib/mix/tasks/pleroma/email.ex | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/lib/mix/tasks/pleroma/email.ex b/lib/mix/tasks/pleroma/email.ex new file mode 100644 index 000000000..2c3801429 --- /dev/null +++ b/lib/mix/tasks/pleroma/email.ex @@ -0,0 +1,25 @@ +defmodule Mix.Tasks.Pleroma.Email do + use Mix.Task + + @shortdoc "Simple Email test" + @moduledoc File.read!("docs/administration/CLI_tasks/email.md") + + def run(["test" | args]) do + Mix.Pleroma.start_pleroma() + + {options, [], []} = + OptionParser.parse( + args, + strict: [ + to: :string + ] + ) + + email = Pleroma.Emails.AdminEmail.test_email(options[:to]) + {:ok, _} = Pleroma.Emails.Mailer.deliver(email) + + Mix.shell().info( + "Test email has been sent to #{inspect(email.to)} from #{inspect(email.from)}" + ) + end +end |