16fe314313f7513efcb854e59202e92732268c9a
[akkoma] / lib / mix / tasks / pleroma / email.ex
1 defmodule Mix.Tasks.Pleroma.Email do
2 use Mix.Task
3 import Mix.Pleroma
4
5 @shortdoc "Simple Email test"
6 @moduledoc File.read!("docs/administration/CLI_tasks/email.md")
7
8 def run(["test" | args]) do
9 Mix.Pleroma.start_pleroma()
10 Application.ensure_all_started(:swoosh)
11
12 {options, [], []} =
13 OptionParser.parse(
14 args,
15 strict: [
16 to: :string
17 ]
18 )
19
20 email = Pleroma.Emails.AdminEmail.test_email(options[:to])
21 {:ok, _} = Pleroma.Emails.Mailer.deliver(email)
22
23 shell_info("Test email has been sent to #{inspect(email.to)} from #{inspect(email.from)}")
24 end
25 end