1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51
| String [] commande = {"ssh " + pool, pass, "telnet " + hostClient + " 25", "helo " + helo, "mail from: " + from, "rcpt to: " + to, "data", "Ceci est un mail test de Orange Business Service, merci de ne pas en tenir compte.", ".", "quit"};
System.out.println("channel ouvert");
Socket sconx;
String response;
InetAddress ourselves;
try
{
ourselves = InetAddress.getLocalHost();
}catch(UnknownHostException uhe){System.out.println("Erreur InetAddress");}
BufferedReader in;
OutputStreamWriter out;
try {
Thread.sleep(3000);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
Interface.Jbody.setText("");
try{
sconx = new Socket(hostTarantel, 22);
if(sconx == null)
System.out.println("Socket echoué");
in = new BufferedReader(new InputStreamReader(sconx.getInputStream()));
out = new OutputStreamWriter(sconx.getOutputStream());
if(in == null || out == null)
System.out.println("Flux échoué");
trace(response = in.readLine());
if(!response.startsWith("220"))
System.out.println("Serveur invalide");
String command;
command = commande[0]; //ssh
out.write(command + "\r\n");
out.flush();
trace(command);
trace(response = in.readLine());
sconx.close();
sconx = null;
}catch(IOException ioe) {System.out.println("Erreur Exception IO");} |
Partager