Import java.net. *; import java.io. *; import java.net. *; public class sendelvismail {public static void main (string s []) {/// send fake mail from elvis presley ///// sendElvisMail [mail server] [recipient address] // mail server can be hostname or IP address // // ex sendElvisMail mail.company.com myFriend@somewhere.qc.ca // sendElvisMail t = new sendElvisMail ();. t. sendMail (s [0], s [1]);} public void sendMail (String mailServer, String recipient) {try {Socket s = new Socket (mailServer, 25); BufferedReader in = new BufferedReader (new InputStreamReader (s.getInputStream (), "8859_1"); bufferedwriter out = new bufferedwriter (S. GetputStream (), "8859_1")); Send (In, Out, "Helo the the TheWorld); // Warning: Some Mail Server Validate The sender address // in the mail from command, put your real address here send (i N, OUT, "Mail from:
"/ n"); out.flush (); system.out.println (s); s = in.printLine (); system.out.println (s);} catch (Exception E) {E.PrintStackTrace () }}} Public void send (bufferedwriter out, string s) {Try {Out.write (S "/ N"); out.flush (); system.out.println (s);} catch (exception e) { E.PrintStackTrace ();}}}