public class MyMail {
public static void main(String[] args) {
// TODO Auto-generated method stub
System.out.println("number of args " + args.length);
String from = "";
String to = "";
String subject = "";
String emailText = "";
for (int i = 0; i < args.length; i++) {
if (args.startsWith("From:")) {
from = args;
System.out.println("MAIL FROM " + from);
} else if(args.startsWith("To:")) {
to = args;
System.out.println("RCPT TO " + to);
} else if(args.startsWith("Subject")) {
subject = args;
System.out.println("SUBJECT " + subject);
} else if (args.startsWith("Body"))
{ //The rest
for (int j = i; j < args.length; j++)
{
emailText += args[j];
}
System.out.println(emailText);
break;
}
}
}
}
May I know how to add spaces in the email body and how to make "mail from" come out before "rcpt to"?