1
我在我的Rails應用程序中使用RestClient發送電子郵件。 下面的curl命令作品:RestClient mailgun錯誤「message」:「'from'參數丟失」
curl -s "https://api:[email protected]/v2/sandbox30000.mailgun.org/messages" \
-F from='Mailgun Sandbox <[email protected]>' \
-F to='me <[email protected]>'\
-F subject='Hello XYZ' \
-F text='Congratulations, you just sent an email with Mailgun! You are truly awesome!'
但是當我嘗試使用RESTClient實現同樣的,我得到了以下錯誤消息:
error response !!{
"message": "'from' parameter is missing"
}
錯誤消息!! 400錯誤的請求
RESTClient實現通話:
RestClient::Request.execute(
:url => "https://api:[email protected]/v2/sandbox0000.mailgun.org/messages",
:method => :post,
:from => 'Mailgun Sandbox <[email protected]>',
:sender => 'Mailgun Sandbox <[email protected]>',
:to => "[email protected]",
:subject => "Hello XYZ",
:text => "Text body",
:"h:X-My-Header" => "www/mailgun-email-send",
:verify_ssl => false)