smtp - Understanding MX records with C# -
i missing piece of understanding how mail transfer works in order implement it. i want implement smtp server, receives email message client, looks recipient mx record of domain in order deliver there. what don't understand happens next, connect domain ip? port? the example looking @ gmail, mx server gmail-smtp-in.l.google.com, program need connect domain on port? thank you read: http://www.ietf.org/rfc/rfc5321.txt short answer: when delivering email. mx records of domain name in question. if mxs exist for domain attempt connect them via port 25 , deliver mail per rfc above. connect them in order of preference listed. lower numbers have higher preference. if equi-cost mx's present, free pick 1 @ random. if 1 doesn't answer try same weight mx before going higher in chain. if no mxs answer queue mail , try again.. if no mxs exist try deliver 'a' record on know port of 25 (smtp). but really, read rfcs , become familiar them, out lot...