• We are using 2 SMTP servers one that runs on Solaris 11 and other that runs on Win 2K8.
  • And I'm compiling the codes using a PC that runs on Windows XP.
  • The business code runs in server that runs on Solaris 11.

I'm forbidden to bring out the business code, its an enterprises application that sends approximately 1000 mails a day.

  1. And the code gets a Socket object for the SMTP server and
  2. Prints some protocol related messages like "MAIL FROM: mail_id@domain.tld" and flushes it.
  3. then gets a input steam object of the socket and checks for error.

This way mails are sent. The problem is that, code that runs in windows PC using Windows SMTP is not running for Solaris SMTP. Why JAVA, which is advocate to be platform portable is behaving like this? Java version is 1.3.2

     Socket socketSMTP= new Socket(server_name,smtp_port);
     BufferedReader reader = new BufferedReader(new java.io.InputStreamReader(socketSMTP.getInputStream()));
     PrintWriter writer= new PrintWriter(socketSMTP.getOutputStream());
     String respones="";
     //--Some codes to check if server is ready --
     writer.println("MAIL FROM:<"+sender_address.trim()+">");
     writer.flush();
     respones=reader.readLine();         
     if(!tmp_msg.startsWith("250"))throw new Exception("Error in protocol "+respones);

this part is where I'm getting error, Solaris SMTP expect 'username' in the place of sender_address whereas Windows SMTP expects 'mail id' in place of sender_address; sender_address is a String variable available from a POJO class

有帮助吗?

解决方案

Well it does work differently + different SMTP servers were installed. Solaris and Windows did not have same SMTP server (the software).

Now we use Windows SMTP I run it from any machine with windows os and vice versa

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top