Socket s = new Socket("mail.dominio.it", 25); //25 è la porta del MailServer
out = new PrintWriter(s.getOutputStream());
in = new BufferedReader(new InputStreamReader(s.getInputStream()));
send(null);
send("HELO " + "PhotoViewer 1.0");
send("MAIL FROM: " + "PhotoViewer(1.0)@netbuilder.it");
send("RCPT TO: " + "davide@netbuilder.it");
send("DATA");
out.println("Testo dell'e-mail");
send(".");
s.close();
public void send(String s) throws IOException
{
if (s != null)
{
System.out.println(s);
out.println(s);
out.flush();
}
String line;
if ((line = in.readLine()) != null)
System.out.println(line);
}