I need to create a Windows service that can listen for SMTP.
When it receives an email I need to process it, and then forward it to my real SMTP server for sending proper.
Can anyone point me at any useful source code, libraries or tutorials on how I can get started doing this?
Seems like all I need is a simple TCP listener and message parser, then I can simply resend the message with the .NET SmtpClient API?
I don't know your entire requirements, but the IIS SMTP service can save incoming email to the /Drop directory. Rather than having to write a full blown TCP/IP service, you could just write a file monitoring service that monitors the /Drop directory for new emails, parses them, and performs your custom action on them.
Eric Daugherty has a C# email server on sourceforge. This will do the server. To forward the messages to another SMTP server the default System.Net.Mail.SmtpClient class can be used.
Or you write a custom transport binding element for WCF (joking).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With