开发者

Understanding MX records with C#

I am probably missing a piece of understanding about how mail tra开发者_StackOverflow社区nsfer works in order to implement it.

I want to implement an SMTP server, it receives an email message from the client, then it looks for the recipient MX record of the domain in order to deliver it there.

What I don't fully understand is what happens next, does it connect to that domain by IP? to which port?

The example I am looking at is Gmail, it MX server is gmail-smtp-in.l.google.com, does my program need to connect to this domain on what port?

Thank you


Read: http://www.ietf.org/rfc/rfc5321.txt

Short Answer:

When delivering email. Look for mx records of the domain name in question.

If MXs exist for for the domain attempt to connect to them via port 25 and deliver you mail per RFC Above. You connect to them in order of preference listed. Lower Numbers have higher preference. If equi-cost MX's are present, you are free to pick one at random. If that one doesn't answer try the same Weight MX before going higher in the chain. If no mxs answer then queue mail and try again..

If no MXs exist try to deliver to the 'A' Record on the well know port of 25 (SMTP).

But really, read the RFCs and become familiar with them, it will help out a lot..

And somewhat related. If you are implementing a SMTP server for use on the internet, Make sure that you have the ability to accept SMTP authenticated email on the Submission port (587) as well as the standard port of 25. As lots of networks have outbound blocks on port 25 for spam abatement purposes..


SMTP operates on port 25. This CodeProject article shows a simplistic local example using C# to send/receive mail.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜