The combination of SMTP service and Telnet service makes network management more convenient. Today, many enterprises use this network. However, our users recently asked about the telnet smtp 535 Error. Today, we will explain the Error content and solution of telnet smtp 535 Error. Use port 25 of the smtp server to check whether the smtp server is available or use socket communication to directly interact with the smtp server, the Error 535 Error: authentication failed is often prompted during user authentication.
This is because when the server requires the client to enter an account, the password must be base64-encoded. some people have switched, but I don't know why, because your conversion is not successful. this type of failure is used. net socket programming is more common. using php as a tool for conversion is easy to succeed. the author has made an experiment in. net, because there is no ready-made Base64 encoding function, a function is issued from the Internet, using this function to encode the mailbox account and password. in php, there is a function base64_encode () you can call it directly. Use the php function to encode the email account and password. The results show that the two results are different, mainly reflected in the account. The two methods have different effects on the suffix @ 163.com encoding. Finally, telnet is used for testing, it is found that the base64_encode () encoding result in php is correct.
Two interesting phenomena are also mentioned here:
1. many people think that using telnet 25 or socket communication to interact with the smtp server can confirm whether a mail account exists, such as entering the account to be tested and then entering a password, the server is expected to return the Account Password error message to confirm that the mailbox exists. however, in most cases, this method does not work. because even if the account exists, the password is incorrect, or the information returned by the account Error is the same, all are: telnet smtp 535 Error: authentication failed. thus, it cannot be determined.
2. Comparison of php and. net syntax. php is indeed much simpler than. net syntax.
For example, to implement socket communication,
. Net Syntax:
Establish a connection:
TcpCliet client = new TcpClient (server, port );
NetWorkStream stream = client. GetStream ();
Send data:
Byte [] arrayToSend = System. Text. Encoding. Default. GetBytes (stringToSend. ToCharArray ());
Stream. Write (arrayToSend, 0, arrayToSend. Length );
Get data:
Int len = stream. Read (bb, 0, bb. Length );
String read = System. Text. Encoding. UTF8.GetString (bb );
String result = read. Substring (0, len );
Php is like:
Establish a connection
$ Fp = fsockopen ($ this-> smtp, 25, $ errno, $ errstr, 60 );
Send data
Fputs ($ fp, $ lastact );
Retrieve Data
$ Lastmessage = fgets ($ fp, 512 );
Another example is to convert strings to base64 format.
. Net
There is no ready-made (maybe I don't know), and I need to compile a function from the Internet into my own project.
Php
Base64_encode () is provided. in fact, this also reflects. net is indeed more rigorous, mainly for classes, type conversion is very strict, but it is indeed troublesome, it is not easy to remember. we hope the above methods can help you solve the problem of telnet smtp 535 Error.