Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Processing incoming email

How do I programmatically read an incoming email with .NET. I need a method to take the content of email message (in this case XML) on a POP server and read it into my application.

Ideally this could be solved by:

  • .NET code that I can run as a background task on my webserver to process the email.
  • A service that can POST the contents of the email to my webserver.

Although I'm open to other options.

EDIT: Copied from the "non-answer":

Currently, we're looking at using the email accounts our hosting company provides.

Our own mail server could potentially be an option, but its something the we'd need to contact the host about.

like image 998
Yozora Avatar asked Jan 15 '09 21:01

Yozora


1 Answers

We have actually just implemented the same kind of thing.

We process the content of email messages and push the data in to our CRM via a web service. We use c# with .net 3.5

To process the mail we went with IMap . There are a few .net client libraries on CodeProject. I think we used the one from LumiSoft .

We tried WebDav but didn't have much luck. This left us with Pop3 or IMap. IMap supports folders, which we needed, so we went with that. I'm sure it would be easy to do the same thing with POP3 if your server does not support IMap.

Basically we connect our Exchange server every hour and pull down any new email and process them. So far it's working well.

Edit: We also use SharpMimeTools to get the raw emails in to a more usable format.

like image 189
Jamie Avatar answered Sep 20 '22 23:09

Jamie