2016-09-25 63 views
-1

發送我的第一封電子郵件可以得到一些幫助嗎?以下是我想發送的內容。我不確定我是否應該使用創建的子域mg.example.com或example.com。該域名在郵件控制面板中處於「活動」和「已驗證」狀態。在Mailgun退回發送測試郵件404找不到

此外,在mailgun.org儀表板中的api私鑰之前還有一個「密鑰」前綴。這是否包含在cURL參數中?我在Windows 10

這是mailgun樣品捲曲CMD從their quickstart curl -s --user 'api:YOUR_API_KEY' \ https://api.mailgun.net/v3/YOUR_DOMAIN_NAME/messages \ -F from='Excited User <[email protected]_DOMAIN_NAME>' \ -F [email protected]_DOMAIN_NAME \ -F [email protected] \ -F subject='Hello' \ -F text='Testing some Mailgun awesomness!'

這是我的版本是:

```` 
curl -s --user 'api:key-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' \ 
    https://api.mailgun.net/v3/mg.example.com/messages \ 
    -F from='Excited User <[email protected]>' \ 
    -F [email protected] \ 
    -F [email protected] \ 
    -F subject='Hello' \ 
    -F text='Testing some Mailgun awesomness!' 
```` 

我也試過這個版本既毫克。 example.com和example.com作爲url。這是響應:

```` 
curl -s --user 'api:key-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' 
https://api.mailgun.net/v3/example.com/messages from='Excited User <[email protected]>' 
[email protected] [email protected] subject='Hello' text='Testing some Mailgun awesomness!' 
```` 

這是我收到的錯誤:

```` 
    HTTP/1.1 405 METHOD NOT ALLOWED 
server: nginx 
date: Sun, 25 Sep 2016 11:40:43 GMT 
content-type: text/html; charset=utf-8 
content-length: 182 
connection: close 
allow: POST, OPTIONS 

&lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"&gt; 
&lt;title&gt;405 Method Not Allowed&lt;/title&gt; 
&lt;h1&gt;Method Not Allowed&lt;/h1&gt; 
&lt;p&gt;The method GET is not allowed for the requested URL.&lt;/p&gt; 
    ```` 

有史以來第一次這樣做。謝謝你的幫助。

回答

1

你有沒有在'捲曲'之前測試過你的網址?

https://api.mailgun.net/v3/https://mg.example.com/messages 

是兩個URL的連接字符串。

選擇,如果它是

https://api.mailgun.net/v3/ 

https://mg.example.com/messages 
+0

錯誤輸入SO,已更正。但答案是否定的。我只是嘗試了url和mg.url。 'curl:(6)無法解析主機:'。 mailgun是什麼意思的活躍和驗證。沒有託管網站,但DNS設置...感謝指導。另外,''''C:\ Users \ aarmand> curl https://api.mailgun.net/v3/ <!DOCTYPE HTML PUBLIC「 - // W3C // DTD HTML 3.2 Final // EN」> 404 Not Found

Not Found

在服務器上找不到請求的URL。

如果您手動輸入網址,請檢查拼寫並重試。

'''' – idkjs

+0

我在查看它之後編輯url語法。現在錯誤是「方法不允許」。 – idkjs

+0

'-X POST'如果需要'POST',這裏是'GET'版本(默認) –

0

是爲我工作是把整個捲曲聲明在一行的解決方案。我將不得不學習如何在Windows環境中使用多線捲曲。