How to send an email with attachment on a JSP file?
Posted on 2007-11-13
I'm developing a JSP file where i can send emails, but i cannot get to send the attachment. These are the details.
file1.jsp -> Form where the user fill the information to send the mail (To, subject, body)
file2.jsp -> This is where the email is actually sent.
this is the code i'm using: (i'm not using servlets just jsp files)
String host = "mailhost.mycompany.com";
String from = "email@example.com";
String to = "firstname.lastname@example.org";
Properties props = System.getProperties();
Session session1 = Session.getDefaultInstance(props, null);
MimeMessage message = new MimeMessage(session1);
String mailmssg = "Hello World\n";
mailmssg += "Hola Mundo\n";
These are what i need:
1. How to create in the file1.jsp a browse button to upload the file?
2. How to send the attachment on file 2?
Please help me experts!!