SMTP in Java
Posted on 2002-06-22
I am creating a small program that I can use to send emails to people. I have gotten the program to work perfectly when I use SMTP servers that dont require authentication. My question is this: How would I modify my code to work for a SMTP server that required authentication?
Socket s = new Socket(smtp.getText(),25);
out = new PrintWriter(s.getOutputStream());
in = new BufferedReader(new InputStreamReader
send("HELO " + InetAddress.getLocalHost().getHostName());
send("MAIL FROM: " + from.getText());
send("RCPT TO: " + to.getText());
out.println("Subject: " + subject.getText());
So what would I add to get this to work with Authentication?