aboutsummaryrefslogtreecommitdiff
path: root/lib/mix
diff options
context:
space:
mode:
authorlain <lain@soykaf.club>2020-01-28 16:42:57 +0000
committerlain <lain@soykaf.club>2020-01-28 16:42:57 +0000
commit12b6fcdb8c8c65311d1a13976dfe8d027bdcd168 (patch)
tree0028c98cb7931305ffcc23880d43eaf247d24feb /lib/mix
parent2c121b26236ea22d339af13243dc188262ace105 (diff)
parent4eb935be78eeaf1decb7fc109cec09ca18d82854 (diff)
downloadpleroma-12b6fcdb8c8c65311d1a13976dfe8d027bdcd168.tar.gz
Merge branch 'features/task-test-email' into 'develop'
Create pleroma.email mix task Closes #1061 See merge request pleroma/pleroma!2118
Diffstat (limited to 'lib/mix')
-rw-r--r--lib/mix/tasks/pleroma/email.ex25
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