Solutions for Mail User Agent: Simplified Version
import java.io.*;
import java.net.*;
public class EmailSender
{
public static void main(String[] args) throws Exception
{
throw new Exception(“220 reply not received from server.”);
}
// Get a reference to the socket’s output stream.
OutputStream os = socket.getOutputStream();
// Send HELO command and get server response.
String command = “HELO x\r\n”;
response = br.readLine();
System.out.println(response);
if (!response.startsWith(“250”)) {
throw new Exception(“250 reply not received from server.”);
}
// Send RCPT TO command.