0
我试图按照tut在我的凤凰应用程序中创建一个邮件程序。我有很远,但现在我想从IEX控制台我得到以下错误发送测试电子邮件:'通过Heroku在Phoenix应用程序中使用Mailgun参数无效错误
iex(2)> Radios.Mailer.my_first_email("[email protected]")
{:error, 400,
"{\n \"message\": \"'to' parameter is not a valid address. please check documentation\"\n}"}
mailer.ex
defmodule Radios.Mailer do
use Mailgun.Client,
domain: Application.get_env(:radios, :mailgun_domain),
key: Application.get_env(:radios, :mailgun_key)
def my_first_email(email_address) do
send_email to: "email_address", #<= this appears to be the issue
from: "[email protected]",
subject: "My first email",
text: "This is an email send with Phoenix and Mailgun"
end
end
config.exs
config :radios,
ecto_repos: [Radios.Repo],
mailgun_domain: "https://api.mailgun.net/v3/XXXXXXXXX.mailgun.org",
mailgun_key: "pubkey-XXXXXXXX"
我一直在瞎搞改变双引号单,并send_email(to: :email_address)
刚才还广告在那里还有我自己的实际地址。
所有没有喜悦。
我错过了什么?
更新 物是人非config.exs到下面:
config :radios, Radios.Mailer,
mailgun_domain: "https://api.mailgun.net/v3/XXXXXXXX.mailgun.org",
mailgun_key: "pubkey-XXXXXX"
但现在得到:
iex(1)> Radios.Mailer.my_first_email("[email protected]")
** (FunctionClauseError) no function clause matching in IO.chardata_to_string/1
(elixir) lib/io.ex:445: IO.chardata_to_string(nil)
(elixir) lib/path.ex:468: Path.join/2
(elixir) lib/path.ex:450: Path.join/1
lib/client.ex:44: Mailgun.Client.send_without_attachments/2
错字? ''email_address''应该是'email_address',因为你想使用变量的值,而不是字符串'“email_address”'。 – Dogbert
'send_email to:email_address,'发出相同的错误。 –
完全相同的错误?你确定? – Dogbert