2

I'm trying to understand exactly what it is I need to be implementing and am just after a little guidance. I know very little about email standards such as POP3, IMAP, SMTP which is probably what's making the getting started difficult.

What'd I'd like to do consists of a couple of things:

  1. Be notified of the arrival of an email at a specific custom address. e.g. hi.me@myapp.com.
  2. Handle multiple addresses per user.
  3. Be able to process this email and either delete it, leave it and be able to display in a web email client or forward it on based on various rules.

I've seen a few SMTP libraries and a POP3 one, but I'm not 100% sure what I need to do this. I'm guessing the best way would be to write a full C# mail server - but I'm hoping for a little guidance/suggestion.

Thanks

4

1 回答 1

2

If you really want to build a mailserver from scratch, the protocol specifications are all available as RFCs.

For IMAP that would be RFC-3501 and for SMTP RFC-2821, you can google for the rest.

I've been working on a C# SMTP server in my (very limited) spare time, mostly out of frustration with existing MTAs and as an exercise in C# server programming. I can tell you that there's a bit more to it than you might think. So if you want fast results, I'd seriously consider hooking into an existing MTA/mailserver setup.

Depending on how fast you want to process messages, it may be sufficient to poll one or more mailboxes. You could process the messages and, for example, forward them to another mailbox using the built-in .NET SmtpClient.

On top of that, all mail servers I know of implement not just the SMTP protocol but also a slew of anti-spam measures. Most of these measures have matured over many years. You get all that for free if you build on top of an existing mail server infrastructure.

Then again, configuration of just about any mail server I know seems to be a fine art, hence my frustration with them.

于 2013-03-30T14:24:50.730 回答