如何在 Elixir 中调用 :mimemail?
How to call :mimemail in Elixir?
antp/mailer calls :mimemail.encode
in mailer/smtp_client.ex。如果它在 mix phoenix.server
内运行,它可以正常工作,但它无法在发布环境(使用 mix release
构建)中调用它。它崩溃并出现以下错误:
(UndefinedFunctionError) undefined function :mimemail.encode/1 (module :mimemail is not available)
在exrm env中是否有调用它的配置,或者缺少配置的东西?
[更新]
我的 mix.exs 中的 application
和 deps
如下:
def application do
[mod: {NeoSmslife, []},
applications: [:phoenix, :phoenix_html, :cowboy, :logger, :gettext,
:phoenix_ecto, :mariaex,
:logger_file_backend,
:tzdata,
:ueberauth,
:ueberauth_facebook,
:ueberauth_twitter,
:timex,
:guardian,
:mailer,
:secure_random
]]
end
defp deps do
[{:phoenix, "~> 1.1.2"},
{:phoenix_ecto, "~> 2.0"},
{:mariaex, ">= 0.0.0"},
{:phoenix_html, "~> 2.3"},
{:phoenix_live_reload, "~> 1.0", only: :dev},
{:gettext, "~> 0.9"},
{:cowboy, "~> 1.0"},
{:logger_file_backend , "~> 0.0.5"},
{:secure_random, "~> 0.2"},
{:mailer, github: "antp/mailer"},
{:guardian, "~> 0.9.0"},
{:guardian_db, "0.4.0"},
{:ueberauth, "~> 0.2"},
{:ueberauth_facebook, "~> 0.3.2"},
{:oauth, github: "tim/erlang-oauth"},
{:ueberauth_twitter, "~> 0.2"},
{:timex, "~> 1.0.1"},
{:mix_test_watch, "~> 0.2", only: :dev},
{:exrm, "~> 1.0.2"}
]
end
尝试将 gen_smtp 添加到您的依赖项和应用程序列表中。我不确定为什么它会在没有对非发布版本的依赖的情况下工作;我的意思是我相信你应该在没有指定 gen_smtp 的情况下得到那个错误。
antp/mailer calls :mimemail.encode
in mailer/smtp_client.ex。如果它在 mix phoenix.server
内运行,它可以正常工作,但它无法在发布环境(使用 mix release
构建)中调用它。它崩溃并出现以下错误:
(UndefinedFunctionError) undefined function :mimemail.encode/1 (module :mimemail is not available)
在exrm env中是否有调用它的配置,或者缺少配置的东西?
[更新]
我的 mix.exs 中的 application
和 deps
如下:
def application do
[mod: {NeoSmslife, []},
applications: [:phoenix, :phoenix_html, :cowboy, :logger, :gettext,
:phoenix_ecto, :mariaex,
:logger_file_backend,
:tzdata,
:ueberauth,
:ueberauth_facebook,
:ueberauth_twitter,
:timex,
:guardian,
:mailer,
:secure_random
]]
end
defp deps do
[{:phoenix, "~> 1.1.2"},
{:phoenix_ecto, "~> 2.0"},
{:mariaex, ">= 0.0.0"},
{:phoenix_html, "~> 2.3"},
{:phoenix_live_reload, "~> 1.0", only: :dev},
{:gettext, "~> 0.9"},
{:cowboy, "~> 1.0"},
{:logger_file_backend , "~> 0.0.5"},
{:secure_random, "~> 0.2"},
{:mailer, github: "antp/mailer"},
{:guardian, "~> 0.9.0"},
{:guardian_db, "0.4.0"},
{:ueberauth, "~> 0.2"},
{:ueberauth_facebook, "~> 0.3.2"},
{:oauth, github: "tim/erlang-oauth"},
{:ueberauth_twitter, "~> 0.2"},
{:timex, "~> 1.0.1"},
{:mix_test_watch, "~> 0.2", only: :dev},
{:exrm, "~> 1.0.2"}
]
end
尝试将 gen_smtp 添加到您的依赖项和应用程序列表中。我不确定为什么它会在没有对非发布版本的依赖的情况下工作;我的意思是我相信你应该在没有指定 gen_smtp 的情况下得到那个错误。