Hi experts , I got problem and need help please.
I have created a servlet sends a message to the client, I have tried to attach a text file with message being sent but I couldn't do that. please help me how to attach a file with a message.

is there something like this :


File file = new File("E:\\text.txt");
Message message = new MimeMessage(session);
.
.
.
.
message.setSubject(subject);
message.setText(text);

message.attach(file);//something like this statement

thank you in advance

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.