Create pleroma.email mix task
Closes: https://git.pleroma.social/pleroma/pleroma/issues/1061
This commit is contained in:
parent
b12f306473
commit
4eb935be78
5 changed files with 116 additions and 0 deletions
25
lib/mix/tasks/pleroma/email.ex
Normal file
25
lib/mix/tasks/pleroma/email.ex
Normal file
|
|
@ -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
|
||||
Loading…
Add table
Add a link
Reference in a new issue