CMD at the command line using the SMTP protocol to send e-mail

  • First, the need to use Telnet service
    • What is Telnet: Telnet is an abbreviation for teletype network, is a remote login program on the Internet, a typical client / server model of service. Telnet remote login feature, allowing users to run Telnet client on the local host, you can log in to a remote Telnet server. In the local input commands may be run on the server, the server returns the results to the local, as operating directly on the server console. This allows the server locally remote operation and control.
    • Telnet protocol: Telnet is an application layer protocol on --- Layer 7 of the OSI model, is provided by creating a virtual terminal connection to a remote host terminal emulation TCP / IP protocol. The agreement must be authenticated by user name and password, a standard protocol for remote login Internet services. Telnet protocol can use the local computer used by the user terminal into a remote host system.
    • Open Telnet: a program a control panel to open or close windows feature a tick "telnet server" and "telnet client" Identify and install.
  • In the CMD, review whether Telnet into force
    • Enter in CMD Telnet, the Telnet service is expected to return to normal as shown proof of use
  • Open mailbox POP3 / SMTP and IMAP / SMTP services, and records the corresponding password. (Login Email Web version, open in the settings)
  • 163 E-mail, for example, send SMTP mail with the CMD command
    • Open the CMD, the mail server is connected, the input CMD: Enter the telnet smtp.163.com 25, 25 is the port number, expected to return: 220 163.com Anti-spam GT for Coremail System (163com [20141201])
    • Identify themselves to the server, continue to enter: helo 163.com, is expected to return: 250 OK
    • Login authentication, the mail server requires authentication to send mail operation, continue to enter: auth after login carriage return, expected return: 334 dXNlcm5hbWU6
    • Enter the mailbox name string of base64 encoding, such as mailbox testtesttest @ 163.com named after the string testtesttest encoded dGVzdHRlc3R0ZXN0, so continue to enter: Enter the dGVzdHRlc3R0ZXN0, is expected to return: 334 UGFzc3dvcmQ6
    • Enter the string of base64 encoded mail password, so continue to enter: Enter the MTExMTEx, is expected to return: 235 Authentication successful
    • Online base64 encoding converter: http: //www1.tc711.com/tool/BASE64.htm
    • Write your message
      • Continue to enter the sender's mailbox: mail from: After <[email protected]> Enter the expected return: 250 Mail OK
      • Continue to enter the recipient's mailbox: rcpt to: the <[email protected]> Enter the expected return: 250 Mail OK, you can have multiple rcpt to
      • Continue Input: data transport, expected returns:. 354 End data with <CR> <LF> <CR> <LF>, mail text entry represents
      • text
        • Continue to enter: from: [email protected] (sender mailbox, you can not write)
        • Continue to enter: to: [email protected] (recipient mailbox, you can not write)
        • subject:hello
        • Here it must be a blank line, downstream began to express the message body content
        • Email test!
        • . (Here is a decimal point alone accounted for one line, indicates that the message editing end)
        • . When finished carriage, expected returns:. 250 Mail OK queued as smtp1, C8mowABXnysFduNXz + qjFQ - 23833S2 1474524750
  • So the recipient client will receive an e-mail sent by the sender
  • SMTP return code meaning
    • Service ready service 220 221 421 Service closing transmission channel is not ready, closing transmission channel
    • 235 user authentication is successful 535 user authentication fails
    • 250 要求的邮件操作完成
    • 334 等待用户输入验证信息
    • 354 开始邮件输入,以.结束
    • 503 错误的命令序列
    • 550 要求的邮件操作未完成,邮箱不可用(例如,邮箱未找到,或不可访问)
  • 参考文档:smtp的底层协议发送邮件-吴老-光荣之路

Guess you like

Origin blog.csdn.net/chang_jinling/article/details/81098666