Click here to Skip to main content
Rate this: bad
Please Sign up or sign in to vote.
See more: C# Server email SMTP
i try to write a custom smtp server with c#. Maybe there is something that i dont really understand about the whole mail stuff, thats why i am asking the question here.
Right now i am able to receive the data that a mailprogram (e.g. MS Outlook) sends to my smtp server (All the HELO stuff is working, hooray!!!!). Lets say that the recipient of the message is So i have the recipient of the message and i know that the recipient email adress is hosted on a server called But how do i transfer kermits mail to I don't need code but i would like to know about the concept, maybe a description on how the smtp server is communicating with the mail server, sending the mail to the mail server or whatever help is absolutely welcome.
Thanks in advance
Posted 2-Jan-13 3:23am
CHill60 at 2-Jan-13 8:56am
Overview explanation at but it may be a bit too high level to be of use.
Same with
but it might get you started.
I haven't posted this a solution in case someone else has better examples
SenolKnd at 2-Jan-13 10:06am
Thanks a lot. I knew about these links already. But like most other links that i stumbled across while searching for an answer, they exactly explain the communication between mail program and smtp server but make a mystery about what happens when the smtp server has to transmit the message to the recipients mailserver. But thank you anyway, any help is welcome, maybe somebody else finds helpful informations about this subject through these links and posts the results here as well.
CHill60 at 2-Jan-13 10:50am
Did you find this article?
SenolKnd at 3-Jan-13 3:26am
No i didn't. Thank you. It explains it better than most of the infos i got when searching the net.

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

The server is not "". That is their domain name. You have to do a DNS look up to get the MX records for and then use those MX records to get A record(s) for their mail server(s).
You can do this manually using nslookup (Easily done with code as well):
Default Server:
> set type=mx
Non-authoritative answer:     MX preference = 10, mail exchanger =     MX preference = 10, mail exchanger =     MX preference = 10, mail exchanger =
> set type=a
Non-authoritative answer:
Once you connect to a mail server, the SMTP commands are more or less the same as the client to server except that your server is now on the sending side.
PS: Emails from Beaker would be awesome! lol "Meep meep meep me-me-meep. Meep meep."

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 410
1 Sergey Alexandrovich Kryukov 370
2 Maciej Los 285
3 ProgramFOX 275
4 CHill60 260
0 OriginalGriff 360
1 ProgramFOX 265
2 Maciej Los 235
3 CHill60 200
4 RyanDev 170

Advertise | Privacy | Mobile
Web04 | 2.8.150331.1 | Last Updated 2 Jan 2013
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100