How to send mail attachment from remote client?
0 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Daniel_Jayapaul
Posted On:   Monday, July 22, 2002 02:34 AM

Hi I am using the code below to send Email with attachments this works very well because I used windows 98 and tomcat in the same machine and when I ported my code to Linux and tomcat and I tried attaching file from client it is not working. What should I do ? Because the remote clients path is not correctly interpreted by Javamail . Any suggestion are welcome. attach = request.getParameter("attach"); %> mbp1 = new MimeBodyPart(); message = request.getParameter("message"); mbp1.setText(message, "ISO-8859-1"); // create the second message part mbp2 = new MimeBodyPart(); Multipart mp = new MimeMultipart(); FileDataSource fd   More>>

Hi

I am using the code below to send Email with attachments this works very well because I used windows 98 and tomcat in the same machine and when I ported my code to Linux and tomcat and I tried attaching file from client it is not working.
What should I do ?
Because the remote clients path is not correctly interpreted by Javamail .
Any suggestion are welcome.


attach = request.getParameter("attach"); %>
mbp1 = new MimeBodyPart();
message = request.getParameter("message");
mbp1.setText(message, "ISO-8859-1");
// create the second message part
mbp2 = new MimeBodyPart();
Multipart mp = new MimeMultipart();
FileDataSource fds = new FileDataSource(attach);
mbp2.setDataHandler(new DataHandler(fds));
mbp2.setFileName(fds.getName());
// create the Multipart and its parts to it
mp.addBodyPart(mbp2);

}

}

mp.addBodyPart(mbp1);

// add the Multipart to the message
msg.setContent(mp);
//msg.setHeader("X-Mailer", mailer);
msg.setSentDate(new Date());
try {
Transport.send(msg);

} catch(Exception e) {
return;
}

   <<Less
About | Sitemap | Contact