smtp.txt 1.7KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. General Notes
  2. --------------
  3. * MX is NOT required, but an A record, or CNAME to a MX MUST be present at the least.
  4. * EHLO should be tried, then fall back to HELO
  5. * The 250 return code from RCPT TO is not actually clear-cut. A 251 may be
  6. returned if the message was forwarded to another address. This could be a
  7. useful indicator to end-users that an address should be updated.
  8. * RCPT TO can accpet just "postmaster" without a domain name
  9. * Server MUST not close connection before:
  10. - QUIT and returning 221 response
  11. - Forced requirement, and only after returning a 421 response
  12. - Clients expriencing a forced connection closure, without prior warning should
  13. just treat it like a 451 closure regardless
  14. * ALWAYS use blocking sockets for the initial connection (this should prevent
  15. Exim4's whining about sync).
  16. Response codes
  17. --------------
  18. * From RFC2821, 4.2.
  19. - In particular, the 220, 221, 251, 421, and 551 reply codes
  20. are associated with message text that must be parsed and interpreted
  21. by machines.
  22. Error Codes
  23. ------------
  24. * Numeric 5yz = Error
  25. - 550/RCPT TO = Relay denied
  26. - 500 = Unknown command
  27. * Numeric 2yz = Normal
  28. * Numeric 4yz = Temporary failure??
  29. <?php
  30. class EsmtpTransport implements Transport, EsmtpCommandWriter {
  31. }
  32. interface EsmtpCommandWriter {
  33. public function getBuffer();
  34. public function executeCommand($command, $expectedCodes);
  35. }
  36. interface Extension {
  37. public function getKeyword();
  38. public function afterEhlo($commandWriter);
  39. public function getRcptParams();
  40. public function getMailParams();
  41. public function atCommand($commandWriter, $command, $expectedResponse) throws CommandSentException;
  42. }