C# 如何使用c通过发送网格读取邮件#

C# 如何使用c通过发送网格读取邮件#,c#,email,serialization,sendgrid,C#,Email,Serialization,Sendgrid,我必须阅读通过发送网格通过c代码发送的邮件 我读过像那样的溪流 --xYzZY Content-Disposition: form-data; name="headers" Received: by 127.0.0.1 with SMTP id 8KwcWqETbu Fri, 25 Jan 2013 03:49:42 -0600 (CST) Received: from mail-ve0-f173.google.com (mail-ve0-f173.google.com [209.8

我必须阅读通过发送网格通过c代码发送的邮件

我读过像那样的溪流

     --xYzZY
Content-Disposition: form-data; name="headers"

Received: by 127.0.0.1 with SMTP id 8KwcWqETbu Fri, 25 Jan 2013 03:49:42 -0600 (CST)
Received: from mail-ve0-f173.google.com (mail-ve0-f173.google.com [209.85.128.173]) by mx5.sendgrid.net (Postfix) with ESMTPS id A1D5A2621B68 for <pk@replydev.socialboards.com>; Fri, 25 Jan 2013 03:49:42 -0600 (CST)
Received: by mail-ve0-f173.google.com with SMTP id b10so69883vea.32 for <pk@replydev.socialboards.com>; Fri, 25 Jan 2013 01:49:42 -0800 (PST)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:x-received:date:message-id:subject:from:to :content-type:x-gm-message-state; bh=w5qN+xkC2AsH6lrtfF/wYnPJ3C3PTO0oVvChHKiLsXM=; b=hgrflJqveG6cOlK5XNz7qI3fJjIOvOeJsmZhyPU+vRFsKlLPctb91oGxz/0v+kzABj us04rC6cW6CWIIR4W1dYfUEpXYdBgbVoOMPs4ef005jMHPOfpMx81YAW6tpq1HQyLh1W 4n49LBm1GssCJhbhwSMUKRwIVqBmLtxMzVPnWVrCqMB8e2KSn78yw58JFOtf7qv+tKE3 oqa4n04ywmcVCKhEx2bhIvpo7IJQ5BjC62Q3iNdQgTJLw1eKQ9nMF8BTxXLFlFZK5HHb fpLFkgiIGqqYJioKtyS0slkJQA1P8OSrjkDnlmLXJU7btatnxd+a94wYKNB6yHwYpL+M f4SQ==
MIME-Version: 1.0
X-Received: by 10.52.179.136 with SMTP id dg8mr4231328vdc.81.1359107382079; Fri, 25 Jan 2013 01:49:42 -0800 (PST)
Received: by 10.58.155.42 with HTTP; Fri, 25 Jan 2013 01:49:42 -0800 (PST)
Date: Fri, 25 Jan 2013 15:19:42 +0530
Message-ID: <CAJfhHSq2qTRHK_0_6jWQyTd9ecB61SJYDyy8mM7G3-atUN13qA@mail.gmail.com>
Subject: dfdsfdsfds
From: Pragati Kumar <pragati.kumar@sdplabs.com>
To: Eric Test <pk@replydev.socialboards.com>
Content-Type: multipart/alternative; boundary=bcaec5014c15b870c904d419d845
X-Gm-Message-State: ALoCoQmTr/zLwW3mbRCZRyL5EOYaPnPrpXB+GEtN+sTQ1PdGB/ulN//n2SaQiYaSbKRyVaqLJfBq

--xYzZY
Content-Disposition: form-data; name="dkim"

none
--xYzZY
Content-Disposition: form-data; name="to"

Eric Test <pk@replydev.socialboards.com>
--xYzZY
Content-Disposition: form-data; name="html"

<div dir="ltr"><br clear="all"><div style>fdsfdsfdsfdsfdsfds</div>-- <br><div dir="ltr"><div>Thanks With Regards.</div><div><br></div><div><b>Pragati Kumar Singh</b></div><div><b>Software Developer (.NET)</b></div><div><b>Mob:  +91 902-363-6285</b></div>
<div><b><br></b></div><div><b>SDPLabs</b></div><div><b><a href="mailto:pragati.kumar@sdplabs.com" target="_blank">pragati.kumar@sdplabs.com</a></b></div><div><b><a href="http://www.sdplabs.com" target="_blank">www.sdplabs.com</a></b></div>
<div><br></div><div>India:  +91 0172 401 0125 (Office)</div><div>           +91 0172 465 0337 (Office)</div><div>USA:   +1 646-462-4634 (Office)</div><div>           +1 646-789-5302 (Cell)</div><div>Fax:   +1 928-563-1783</div>
</div>
</div>

--xYzZY
Content-Disposition: form-data; name="from"

Pragati Kumar <pragati.kumar@sdplabs.com>
--xYzZY
Content-Disposition: form-data; name="text"

fdsfdsfdsfdsfdsfds
-- 
Thanks With Regards.

*Pragati Kumar Singh*
*Software Developer (.NET)*
*Mob:  +91 902-363-6285*
*
*
*SDPLabs*
*pragati.kumar@sdplabs.com*
*www.sdplabs.com*

India:  +91 0172 401 0125 (Office)
           +91 0172 465 0337 (Office)
USA:   +1 646-462-4634 (Office)
           +1 646-789-5302 (Cell)
Fax:   +1 928-563-1783

--xYzZY
Content-Disposition: form-data; name="spam_report"

Spam detection software, running on the system "mx5.sendgrid.net", has
identified this incoming email as possible spam.  The original message
has been attached to this so you can view it (if it isn't spam) or label
similar future email.  If you have any questions, see
the administrator of that system for details.

Content preview:  fdsfdsfdsfdsfdsfds -- Thanks With Regards. *Pragati Kumar
  Singh* *Software Developer (.NET)* *Mob:  +91 902-363-6285* * * *SDPLabs* *pragati.kumar@sdplabs.com*
   *www.sdplabs.com* India:  +91 0172 401 0125 (Office)  +91 0172 465 0337 (Office)
   USA:  +1 646-462-4634 (Office)  +1 646-789-5302 (Cell) Fax: +1 928-563-1783
   [...] 

Content analysis details:   (-0.7 points, 5.0 required)

 pts rule name              description
---- ---------------------- --------------------------------------------------
 0.0 HTML_MESSAGE           BODY: HTML included in message
-0.7 RCVD_IN_DNSWL_LOW      RBL: Sender listed at http://www.dnswl.org/, low
                            trust
                            [209.85.128.173 listed in list.dnswl.org]
 0.0 T_MIME_NO_TEXT         No text body parts


--xYzZY
Content-Disposition: form-data; name="envelope"

but I am unable verify its format so that it could be inserted into our database.
Please help to decode it so that I can read the following fields in the best possible way.
1. To
2. From
3. BCC
4. Body
5. Subject
6. Attachment.

Thanks in anticipation


{"to":["pk@replydev.socialboards.com"],"from":"pragati.kumar@sdplabs.com"}
--xYzZY
Content-Disposition: form-data; name="attachments"

0
--xYzZY
Content-Disposition: form-data; name="subject"

dfdsfdsfds
--xYzZY
Content-Disposition: form-data; name="spam_score"

-0.689
--xYzZY
Content-Disposition: form-data; name="charsets"

{"to":"UTF-8","html":"ISO-8859-1","subject":"UTF-8","from":"UTF-8","text":"ISO-8859-1"}
--xYzZY
Content-Disposition: form-data; name="SPF"

none
--xYzZY--
如需更多参考,请查看
但是它是用php给出的,我想用C#

在艰难的时间后找到解决方案。 这些是多部分/表单数据的内容。 每个数据都可以读取

    HttpContext context;
    String to=context.Request.Params["to"];
    String from=context.Request.Params["from"];
    String html=context.Request.Params["html"];
        .......etc..............

阅读其内容和节点后,可以将其传递给类属性,然后根据您的要求将其序列化为json或xml。

我们需要筛选大量内容。你在这方面做过什么努力吗?尝试了一些东西,但效果不理想?向我们展示你的尝试,并解释它是如何不起作用的。目前,这不像是一个问题,而是一个要求。这不是堆栈溢出的工作原理。@paul感谢您的回复,但我已经对其进行了评审。它的代码只用于发送邮件,而不用于通过发送网格读取邮件,我必须读取邮件而不是发送。请查看我的帖子。@David我已尝试将其序列化为json格式,以便可以读取。但是失败了。@PragatiSingh:根据文档()的说明,该方法需要一个JSON格式的字符串。问题中那个巨大的、看起来像电子邮件的字符串不是JSON,尽管它的一小部分看起来很接近JSON。
Error reading JObject from JsonReader.
    HttpContext context;
    String to=context.Request.Params["to"];
    String from=context.Request.Params["from"];
    String html=context.Request.Params["html"];
        .......etc..............