1

誰かが SendGrid の Parse API を使用して、ASP.NET MVC を使用して電子メールを受信したのではないでしょうか。

彼らの指示に従って、SendGrid アカウントをセットアップしました: http://sendgrid.com/documentation/display/api/Parse

また、サイトの任意のアドレスにメールを送信すると、ASP.Net MVC ActionMethod が呼び出されますが、リクエストに関する情報が表示されません。

アクション メソッド内の Request オブジェクトにアクセスしようとすると、Length が約 12KB と表示されますが、情報が表示されません。- Request.Form には何もありません - Request.Files.Length は 0 です - Request.InputStream.Length は 0 です

また、FormCollection パラメーターを作成すると空になり、共通フィールド (to、from、html、text) のアクション メソッドで文字列引数を設定すると、要求が処理されるときにすべて null になります。

これをうまく使った人はいますか?私は何が欠けていますか?

ありがとう

4

1 に答える 1

0

You need to turn off input Validation. It will throw exceptions on fields where there is data. Otherwise, the information should be available in the Request.Form collection

[HttpPost]
[ValidateInput(false)]
public ActionResult SendGrid(string from, string to, string text, string subject) //...
{                  
       ProcessEmail(from,to,text,subject...); // your function here
       return new EmptyResult();
}

In MVC, you must also set requestValidationMode="2.0" in your web.config or it will still throw on Form Validation.

 <system.web>
  <httpRuntime requestValidationMode="2.0"/>
 </system.web>
于 2011-09-29T02:00:30.983 に答える