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