How to set up to retrieve email from different users
843830Jun 20 2007 — edited Jun 21 2007Hi,
I have the following problem:
I have written a Java application for some video/postproduction work.
This application is using Java webstart, so different users are able to use the application via internet. Now I want the users to be able to send the content of a JTextField by e-mail automatically.
right now I have it working, but only if I set-up the java application first to the smtp server of the client. But because there are different clients with different smtp servers I can't use this method.
I'm looking to use only the default Java Api,
so that any user easily can use the application.
So what I want to accomplish:
user start application
user fill in TextField
user clicks e-mail button(which send mail to test@server.com)
I don't need to see the e-mail adress from the user,
but I want to see the mail from the different users all as the mail fromApplication@server.com.
right now I can set up the application for one user
with the following code:
BufferedReader buffRead;
PrintStream printStream;
try{
socket = new Socket("smtp.xs4all.nl", 25);
buffRead = new BufferedReader(
new InputStreamReader(socket.getInputStream()));
printStream = new PrintStream(socket.getOutputStream()); printStream.println("HELO xs4all.nl");
printStream.println("mail from: spot@postmen.tv");
System.out.println(buffRead.readLine());
String Addressee= "peter.vanrij@student.hu.nl";
printStream.println("rcpt to: " + Addressee);
System.out.println(buffRead.readLine());
printStream.println("data");
String clientName = clientField.getText();
printStream.println("Subject:EDL from "+clientName+" is"+mailStatus+"\n\n");
System.out.println(buffRead.readLine());
String tempmail = edlArea.getText();
printStream.println(tempmail);
printStream.println(".");
System.out.println(buffRead.readLine());
printStream.flush();
socket.close();
sorry about the layout.
this works, but only if the user has mailserver xs4all
does someone know a method for getting this to work with every user?