Skip to main content

Appendix E. Other Gateway Issues

This appendix discusses special considerations for mail gateways that connect SMTP to other mail systems.

E.1. Gateway Responsibilities

A mail gateway connecting SMTP to another mail system must:

  1. Translate Addresses

    • Convert between SMTP format and other system's format
    • Maintain bidirectional mapping
    • Document translation rules
  2. Translate Headers

    • Map SMTP header fields to equivalent in other system
    • Preserve semantic meaning
    • Add gateway-specific tracking fields
  3. Translate Content

    • Handle character set differences
    • Convert content encoding if needed
    • Preserve attachments where possible
  4. Handle Delivery Notifications

    • Translate DSNs between systems
    • Report failures appropriately
    • Map error codes

E.2. X.400 Gateway Example

SMTP to X.400:

  • Convert RFC 5322 address to X.400 O/R address
  • Map SMTP headers to X.400 P2 headers
  • Preserve message content

X.400 to SMTP:

  • Convert X.400 O/R address to RFC 5322 format
  • Map X.400 headers to SMTP headers
  • Maintain delivery reports

E.3. Address Mapping Challenges

Problem: Different addressing schemes

SMTP: [email protected] UUCP: host!user X.400: /C=US/ADMD=ATT/PRMD=XYZ/S=Smith/G=John/

Gateway must:

  • Convert addresses in both directions
  • Handle addresses in different parts (envelope and headers)
  • Deal with untranslatable addresses

E.4. Character Set Issues

SMTP traditionally uses 7-bit ASCII. Gateways to systems with different character sets must:

  1. Identify Encoding: Detect character set of incoming message
  2. Convert Safely: Translate to target system's encoding
  3. Mark Clearly: Indicate encoding in headers (MIME Content-Type)
  4. Handle Failures: Deal with untranslatable characters

E.5. Content Conversion

When content formats differ:

Text:

  • Line ending conversion (CRLF vs LF vs CR)
  • Character set translation
  • Text wrapping/unwrapping

Binary:

  • Encoding (Base64, Quoted-Printable)
  • Type preservation
  • Filename handling

Rich Text:

  • HTML to/from other formats
  • Formatting preservation
  • Fallback to plain text

E.6. Loop Prevention in Gateways

Gateways must prevent mail loops:

SMTP → Gateway A → Other System → Gateway B → SMTP (loop!)

Prevention Methods:

  1. Track Message-ID across gateway
  2. Add gateway-specific tracking headers
  3. Limit hop count across gateway conversions
  4. Detect repeated gateway processing

E.7. Error Handling

Gateway-specific errors:

Translation Failures:

  • Untranslatable address → Return 5xx error
  • Character set issues → Return error or best-effort conversion
  • Format incompatibility → Reject or convert with loss warning

Delivery Failures:

  • Other system rejects → Translate to SMTP error code
  • Timeout in other system → Return temporary failure (4xx)
  • Permanent failure → Return permanent failure (5xx)

E.8. Gateway Received Headers

Gateways must add appropriate Received headers:

Received: from smtp.example.com by gateway.example.com
with SMTP (gateway to X400) id 12345
for [email protected]; Wed, 24 Dec 2024 10:00:00 +0000

Include:

  • Source protocol (SMTP)
  • Destination protocol (in comments)
  • Gateway identification
  • Timestamp

E.9. Best Practices

  1. Document Translation: Clearly document all address and header translations
  2. Preserve Information: Keep as much original information as possible
  3. Add Tracking: Add gateway-specific headers for debugging
  4. Test Thoroughly: Test with various message types and edge cases
  5. Monitor: Log gateway operations for troubleshooting
  6. Update: Keep gateway software updated for security and compatibility