SMTP relay in C #?

I need to create a windows service that can listen on SMTP .

When he receives an email, I need to process it and then forward it to my real SMTP server to send it correctly.

Can someone point me to any useful source code, libraries or tutorials on how I can start doing this?

It seems that all I need is a simple TCP receiver and a message parser, then can I just send a message using the .NET SmtpClient API?

+4
source share
3 answers

I donโ€™t know all your requirements, but IIS SMTP can save incoming email to the / Drop directory. Instead of writing a full-blown TCP / IP service, you can simply write a file monitoring service that monitors the / Drop directory for new emails, parses them, and performs your own action.

+4
source

Eric Dougherty has a C # email server at sourceforge . This will make the server. To forward messages to another SMTP server, the standard System.Net.Mail.SmtpClient class can be used.

Or you are writing a custom transport binding element for WCF (just kidding).

+3
source

You probably want to check the link. The article states that "MailServerComponent implements POP3 and SMTP (core) servers. It processes POP3 and SMTP commands and generates events accordingly. MailServer processes MailServerComponent events and searches for and stores mail." This may at least serve as a starting point for you.

And you're right, you can implement your own (TCP) socket receiver, which processes and processes all the necessary SMTP messages. Check protocol specifications here .

+2
source

All Articles