我想在Rails中将Mailgun与HTTParty一起使用:
RestClient.post "https://api:key-###"\
"@api.mailgun.net/v3/###/messages",
from: from_email,
to: to_email,
subject: title,
html: body_text
它正在工作,但是
payload = {
from: email_history.from_email,
to: email_history.to_email,
subject: email_history.title,
html: email_history.body_text,
multipart: true
}
response = SendEmailJob.post('https://api:key-###'\
'@api.mailgun.net/v3/###/messages', payload)
返回:
{
"message": "'from' parameter is missing"
}
我检查了是否存在有效载荷“ from”参数。
我该如何解决?
答案 0 :(得分:0)
我通过添加主体解决了这个问题:
{% for ksiazki in ksiazki %}
{% for book_choices in ksiazki_obj.gatunek %}
{{ book_choices }}
<li class="list-group-item list-group-item-info">('Biografia', 1, 'Biografia')</li>
<li class="list-group-item list-group-item-info">('FANTASTYKA', 2, 'Fantasy/Sci-Fi')</li>
<li class="list-group-item list-group-item-info">('HISTORYCZNY', 3, 'Historyczny')</li>
<li class="list-group-item list-group-item-info">('HORROR', 4, 'Horror')</li>
<li class="list-group-item list-group-item-info">('POEZJA', 5, 'Poezja')</li>
<li class="list-group-item list-group-item-info">('PRZYGODA', 6, 'Przygoda')</li>
<li class="list-group-item list-group-item-info">('ROMANS', 7, 'Romans')</li>
<li class="list-group-item list-group-item-info">('DRAMAT', 8, 'Dramat')</li>
{% endfor %}
{% endfor %}