【问题标题】:How to call :mimemail in Elixir?如何在 Elixir 中调用 :mimemail?
【发布时间】:2016-03-14 20:17:54
【问题描述】:

antp/mailermailer/smtp_client.ex 中调用:mimemail.encode。如果它在mix phoenix.server 中运行,它可以正常工作,但它无法在发布环境(使用mix release 构建)中调用它。它因以下错误而崩溃:

(UndefinedFunctionError) undefined function :mimemail.encode/1 (module :mimemail is not available)

是否有任何配置可以在 exrm env 中调用它,或者错过要配置的内容?

[更新] applicationdeps 在我的 mix.exs 中如下:

 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

【问题讨论】:

  • 发布你的 mix.exs。

标签: elixir phoenix-framework


【解决方案1】:

尝试将gen_smtp 添加到您的依赖项和应用程序列表中。我不确定为什么它会在不依赖非发布版本的情况下工作;我的意思是,我相信在没有指定 gen_smtp 的情况下,你应该得到那个错误。

【讨论】:

  • 通过将gen_smtp 附加到应用程序和部门中,它可以正常工作。谢谢你!
猜你喜欢
  • 2016-05-18
  • 2011-03-17
  • 2023-03-05
  • 1970-01-01
  • 2011-08-07
  • 1970-01-01
  • 1970-01-01
  • 2017-02-09
  • 2015-06-16
相关资源
最近更新 更多