Followers

Friday, September 28, 2007

SMTP

import java.lang.*;
import java.util.*;
import java.io.*;

class asx {

public static void main(String[] args)
{


Scanner domain = new Scanner(System.in);
System.out.println("Enter the Domain Name");
String dname = domain.nextLine();

Scanner mail = new Scanner(System.in);
System.out.println("Mail From:");
String mfrom = mail.nextLine();

Scanner recp = new Scanner(System.in);
System.out.println("Rcpt To:");
String rcpt = recp.nextLine();

Scanner cc = new Scanner(System.in);
System.out.println("CC to:");
String carbon = cc.nextLine();

Scanner dt = new Scanner(System.in);
String dta = dt.next();


Scanner subject = new Scanner(System.in);
System.out.println("Subject:");
String subj = subject.nextLine();

Scanner msg = new Scanner(System.in);
System.out.println("Message");
String mess = msg.nextLine();



try {
BufferedWriter out = new BufferedWriter(new FileWriter("\\smtp.txt")); // The Output File(smtp.txt) will be in the Drive where the Program is Executed from.
out.write("ehlo "+ dname);
out.newLine();
out.write("mail From:" + mfrom);
out.newLine();
out.write("Rcpt to:" + rcpt);
out.newLine();
out.write("CC to:" + carbon);
out.newLine();
out.write(dta);
out.newLine();
out.write("Subject:" + subj);
out.newLine();
out.write("Message:" + mess);
out.newLine();
out.write(".");
out.close();
} catch (IOException e) {

}




}
}

No comments: