tags:

views:

44

answers:

4

Hi all

Is it possible to build a system or mail server/service to receive and parse it to extract the text in C#?

Does anyone do it before?

Best Regards,

A: 

Are you asking if it is possible to write a mail-server in C#?

Of course it is. I didn't see any MailServer objects that'll handle this for you, however you could just as easily read the RFCs involved (http://en.wikipedia.org/wiki/Simple_Mail_Transfer_Protocol) and write it using the TCPClient classes.

Erich
Maybe I am not so clear.Let take a example, I have a cinema, I want to make user to send email to cinema.Is it possible to make a service or something like that to receive the mail in some specify format, and parse the mail, then book the ticket.
Yongwei Xing
Yes, it is possible to make a service that'll do this. You'd make a windows service that listens on the SMTP port via TCP and implements the SMTP protocol. Upon receiving a message, it would parse the email, and book the ticket.However, an email seems to be a bad way to do this. There are dozens of better forms of submitting data.
Erich
we have a internal site, but we need contact with user external.The users can not access our internal site.
Yongwei Xing
Sounds like a job for a web service or website.
Erich
A: 

I've used the Mime4Net library for the parsing very effectively. Email is not a format you want to hand code parsing for. The standard is HUGE and rather complicated.

Russell Steen
Maybe I am not so clear.Let take a example, I have a cinema, I want to make user to send email to cinema.Is it possible to make a service or something like that to receive the mail in some specify format, and parse the mail, then book the ticket.
Yongwei Xing
A: 

It might be better to ignore dedicated parser/lexer to do this as the standards for email vary wildly depending on the email transporter, or you can simply ignore the email headers...the only snag is if the email is composed of MIME data...use this Mime4Net to handle this for you or browse around in the open source directory of C# to find the right solution for you.

Hope this helps, Best regards, Tom.

tommieb75
Maybe I am not so clear.Let take a example, I have a cinema, I want to make user to send email to cinema.Is it possible to make a service or something like that to receive the mail in some specify format, and parse the mail, then book the ticket.
Yongwei Xing
@Yongwei: Ahhhh my bad....I think that sounds a not-so-good idea as you're forcing the user to send a specific email, perhaps by looking at the subject line: Book Cinema=Yes then its feasible...sorry for my wrong answer! :(
tommieb75
A: 

In our company, we have a windows service that does this:

  • connect to an email account;
  • download the messages to a database;
  • looks the messages for a specific string, indicating an IP address;
  • save to another table to be processed later.

If I correctly understood your question, you could do the same thing.

Fernando
What do you mean "connect to an email account"? You mean your company's windows service can access the user mail account? Or your service access a specify email account? Another question,how does your service know there is a mail coming?Does it check the mail account every 1 or 5 or 10 mins? Thanks
Yongwei Xing
The service is configured to acess an specific mail account every N minutes (where N can be configured too). So, the user (in our case, a monitoring tool) would send a message to that account.
Fernando