Right, so here is some sample code and tutorial to get Email2HTTP to work with ASP.NET. Its extremely simple:

First, sign up for an account at Email2HTTP.com. Once you have your account, set up a domain or use the sample on they give you when you sign up:

Once your domain is setup (I used the sample, so everything, including MX records and DNS was already setup. if you are using a different one, you will need to follow the instructions) you need to add a Target URL. this is where email gets redirected to.

<p mce_keep="true"> </p>

Name your target and add the URL you want to receive the email. next, we you are going to want to write the code.

Here is a VERY SIMPLE example I have built. I built it in a ASP.NET handler page (ASHX). this just made my life a little easer.

public void ProcessRequest (HttpContext context) {
       string subject = “”;
       string body = “”;
       context.Response.Write(context.Request.Form.Keys.Count);
       context.Response.Write(“
”);
       subject = context.Request.Form.Get(“subject”);
       body = context.Request.Form.Get(“body”);
       context.Response.Write(s);
       context.Response.Write(“
”);
       context.Response.Write(“Body: ” + body);
       context.Response.Write(“
”);
       context.Response.Write(“Subject: ” + subject);
   }<p mce_keep="true"> </p>

Anything that is written back gets emailed back to the user. So, if you emailed, say a stock symbol, you could call a web service, get some information and send it back to the user via email.

This is very cool! Couple of things that would be nice: instead of calling the webserver directly with all the posted data, which is done now and could be “spoofed”, call the webserver and post a key, which could be used then by the server to call the service and get the information. this could also be handy for servers which are inside a network: they could poll the service every, say, 5 minutes and pull information down. It would not be real time, but it would allow “hidden” servers to use the service.

kick it on DotNetKicks.com