Unable te send attachment through weblogic on Solaris
Hi I am trying to send mail using Javamail api using web server as wweblogic 6 on soalris and client browser on windows but it throws exception File Not Found.
Following is the code:
/** Create the JavaMail session **/
Properties properties = System.getProperties();
properties.put("mail.smtp.host", smtpHost);
Session session = Session.getInstance(properties, null);
session.setDebug(debug);
/** Construct the message **/
MimeMessage message = new MimeMessage(session);
/** Set the from address**/
Address fromAddress = new InternetAddress(fromName);
message.setFrom(fromAddress);
/** Parse and set the recipient addresses**/
InternetAddress[] toAddresses = {new InternetAddress(toAddress)};
message.setRecipients(Message.RecipientType.TO,toAddresses);
message.setSubject(subject);
MimeBodyPart mbpMessage = new MimeBodyPart();
mbpMessage.setText(msg);
MimeBodyPart mbpAttachment = new MimeBodyPart();
/** create the Multipart and its parts to it **/
Multipart mp = new MimeMultipart();
mp.addBodyPart(mbpMessage);
FileDataSource fds;
/** attach the file to the message**/
if(!(attachment.equals("")))
{
fds = new FileDataSource(attachment);
System.out.println("File in attachment is ...."+fds.getFile());
mbpAttachment.setDataHandler(new DataHandler(fds));
mbpAttachment.setFileName(fds.getName());
mp.addBodyPart(mbpAttachment);
}
/** add the Multipart to the message**/
message.setContent(mp);
message.setSentDate(new Date());
/*Address[] ccAddresses = InternetAddress.parse(cc);
message.setRecipients(Message.RecipientType.CC,ccAddresses);*/
/* Address[] bccAddresses = InternetAddress.parse(bcc);
message.setRecipients(Message.RecipientType.BCC,bccAddresses);*/
/** Transporting the message **/
String transid = "00100 " + msgID;
msgID++;
Transport.send(message);
Same code runs well with weblogic on windows.
Please help me .
Rajeev

