SMTP protocol to send the whole process of mail

 

Use SMTP mail _ to send mail using SMTP to send mail _ _ _ push mail User Guide - Ali cloud https://help.aliyun.com/knowledge_detail/51622.html

Sending mail through the SMTP protocol overall process is as follows:

  1. The client uses the telnet command to connect to the SMTP server, a session is established.
  2. The client sends a HELO or EHLO command.
  3. The client sends a command AUTH authentication for user login (using smtpd way).
  4. The client sends a MAIL command specifies the sender.
  5. The client sends a RCPT command specifies the recipient.
  6. The client sends a DATA command ready to enter the body of the message.
  7. Client sends a Command (Command dot) indicates the end of the DATA command.
  8. The client sends a QUIT command to end the session.

Examples

To help you get familiar with the process to send mail using SMTP protocol, the following command telnet session example, to describe the SMTP command session.

Note : where S represents the server, C behalf of the client. You can use the Linux command echo -n Content | base64 base64-encoded.

  1. $telnet smtpdm.aliyun.com 25
  2. S:220 smtp.aliyun-inc.com MX AliMailServer(127.0.0.1)
  3. C:EHLO test.com
  4. S:250-smtp.aliyun-inc.com
  5. S:250-8BITMIME
  6. S:250-AUTH=PLAIN LOGIN XALIOAUTH
  7. S:250-AUTH PLAIN LOGIN XALIOAUTH
  8. S:250-PIPELINING
  9. S:250 DSN
  10. C:AUTH LOGIN
  11. S:334 dXNlcm5hbWU6
  12. C:dGVzdEB0ZXN0LmNvbQ==备注:用户名test@test.combase64编码
  13. S:334UGFzc3dvcmQ6
  14. C:dGVzdA==备注:用户密码testbase64编码
  15. S:235Authentication successful
  16. C:MAIL FROM:<test@test.com>备注:注意用<>将发件人扩起来
  17. S:250MailOk
  18. C:RCPT TO:<test@test.com>
  19. S:250RcptOk
  20. C:DATA
  21. S:354End data with<CR><LF>.<CR><LF>
  22. C:subject: test
  23. C:from:<test@test.com>
  24. C:to:<test@test.com>
  25. C:
  26. C:test
  27. C:.
  28. S:DataOk: queued as freedom ###envid=148316944
  29. C:QUIT
  30. S:221Bye

 

 

Guess you like

Origin www.cnblogs.com/yuanjiangw/p/12590037.html