Hi,
I amreally new to java,
I have program which sends mails continoulsy.This is sentr as attachement.
Now i want to change into inline matter.
so user doesnt have to download and open the attachment.
---------------------------------------------------------
java.util.Date d=new java.util.Date();
String tm=d.getHours()+":"+d.getMinutes();
message.setSubject("# " + strTitle + strSubject + " " + tm);
MimeBodyPart mbp1 = new MimeBodyPart();
mbp1.setText(strMailText);
// create the second message part
MimeBodyPart mbp2 = new MimeBodyPart();
// attach the file to the message
FileDataSource fds=new FileDataSource("c:\\program files\\unijust\\data_out\\"+ strattachfile);
mbp2.setDataHandler(new DataHandler(fds));
mbp2.setFileName("Feedback.txt"
;
// create the Multipart
//and its parts to it
Multipart mp = new MimeMultipart();
mp.addBodyPart(mbp1);
mp.addBodyPart(mbp2);
// add the Multipart to the message
message.setContent(mp);
message.saveChanges();
Transport transport = session.getTransport("smtp"
;
transport.addConnectionListener(conHandler);
transport.addTransportListener(transHandler);
transport.connect(mailHost,"",""
;
transport.sendMessage(message,message.getAllRecipients());
-------------------------------------------------------
Regards
John Philip
*** Even the Best, did the Bad and Made the Best ***
John Philip
I amreally new to java,
I have program which sends mails continoulsy.This is sentr as attachement.
Now i want to change into inline matter.
so user doesnt have to download and open the attachment.
---------------------------------------------------------
java.util.Date d=new java.util.Date();
String tm=d.getHours()+":"+d.getMinutes();
message.setSubject("# " + strTitle + strSubject + " " + tm);
MimeBodyPart mbp1 = new MimeBodyPart();
mbp1.setText(strMailText);
// create the second message part
MimeBodyPart mbp2 = new MimeBodyPart();
// attach the file to the message
FileDataSource fds=new FileDataSource("c:\\program files\\unijust\\data_out\\"+ strattachfile);
mbp2.setDataHandler(new DataHandler(fds));
mbp2.setFileName("Feedback.txt"
// create the Multipart
//and its parts to it
Multipart mp = new MimeMultipart();
mp.addBodyPart(mbp1);
mp.addBodyPart(mbp2);
// add the Multipart to the message
message.setContent(mp);
message.saveChanges();
Transport transport = session.getTransport("smtp"
transport.addConnectionListener(conHandler);
transport.addTransportListener(transHandler);
transport.connect(mailHost,"",""
transport.sendMessage(message,message.getAllRecipients());
-------------------------------------------------------
Regards
John Philip
*** Even the Best, did the Bad and Made the Best ***
John Philip