I was wondering how to distinguish inbound from outbound SMTP transactions.

Normally this would be a straightforward question, however my SMTP server has to handle a special case:

  • Other domains might point to my MX domain (mail address aliases)

What outbound criteria should I check for? Is it as simple as checking if the transaction is authenticated (via the AUTH command), or do any other rules apply (derived from the FROM/RCPT addresses)? I guess alias addresses can be detected by resolving their MX?

  • The side that sends the first TCP packet with the SYN flag set is who determines if it is inbound or outbound. Some more context here would have made this a better question.
    – Zoredache
    Dec 6, 2012 at 23:36
  • What are you talking about? I'm talking about SMTP not TCP. A SMTP connection can be inbound or outbound (relay) regardless of your SYN flags.
    – Era
    Dec 7, 2012 at 5:05

1 Answer 1


If the sender is in your domain, it's outbound.

If the recipient is in your domain, it's inbound.

If neither are in your domain, it's relay, and drop it like a hot potato.

  • What if both are in my domain?
    – Era
    Dec 7, 2012 at 5:23
  • Then it's entirely local. Dec 7, 2012 at 5:24
  • 1
    I guess I'm just over-thinking this...
    – Era
    Dec 7, 2012 at 5:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.