bikkerss
Legacy Member
ik probeer een mail form toe te voegen aan een applicatie maar stuut op een probleem
ik kan mails versturen maar vanaf het moment dat ik een bijlage plaats bij deze mail krijg ik de mail toegezonden met bijlage maar krijg als tekst iets dergelijks als
javax.mail.internet.MimeMessage@92eb86
if(jList1.getModel().getSize()>0)
{
BodyPart messageBodyPart = new MimeBodyPart();
messageBodyPart.setText(inhoud);
messageBodyPart2 = new MimeBodyPart();
Multipart multipart = new MimeMultipart();
for( int i = 0; i < jList1.getModel().getSize(); i++ )
{
FileDataSource fileDataSource =new FileDataSource(jList1.getModel().getElementAt(i).toString() );
messageBodyPart2.setDataHandler(new DataHandler(fileDataSource));
messageBodyPart2.setFileName(jList1.getModel().getElementAt(i).toString());
multipart.addBodyPart(messageBodyPart);
multipart.addBodyPart(messageBodyPart2);
}
// Put parts in message
msg.setContent(multipart);
}
Transport.send(msg);
JOptionPane.showMessageDialog(rootPane, "uw bericht aan " + Mail_aan.getText() + " is verzonden") ;
} catch (MessagingException mex)
{
System.out.println("VERSTUREN MISLUKT FOUT BIJ : " + mex);
}
}
@Action
public void attach() throws SqlJetException, MessagingException
{
int y=1;
final JFileChooser kiesattachment = new JFileChooser();
kiesattachment.setBounds(0,0,400,400);
for (i = 0 ; i <=5; i++)
{
kiesattachment.setVisible(rootPaneCheckingEnabled);
int attach = kiesattachment.showDialog(Mail.this, "Voeg toe");
attachlijst.add(i, kiesattachment.getSelectedFile());
y++;
JDialog.setDefaultLookAndFeelDecorated(true);
int response = JOptionPane.showConfirmDialog(null, "Wilt u nog een bijlage toevoegen?", "Confirm",
JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE);
if (response == JOptionPane.NO_OPTION)
{
jList1.setModel(attachlijst);
i=6;
} else if (response == JOptionPane.YES_OPTION) {
}
else if (response == JOptionPane.CLOSED_OPTION) {
System.out.println("");
}
ik kan mails versturen maar vanaf het moment dat ik een bijlage plaats bij deze mail krijg ik de mail toegezonden met bijlage maar krijg als tekst iets dergelijks als
javax.mail.internet.MimeMessage@92eb86
if(jList1.getModel().getSize()>0)
{
BodyPart messageBodyPart = new MimeBodyPart();
messageBodyPart.setText(inhoud);
messageBodyPart2 = new MimeBodyPart();
Multipart multipart = new MimeMultipart();
for( int i = 0; i < jList1.getModel().getSize(); i++ )
{
FileDataSource fileDataSource =new FileDataSource(jList1.getModel().getElementAt(i).toString() );
messageBodyPart2.setDataHandler(new DataHandler(fileDataSource));
messageBodyPart2.setFileName(jList1.getModel().getElementAt(i).toString());
multipart.addBodyPart(messageBodyPart);
multipart.addBodyPart(messageBodyPart2);
}
// Put parts in message
msg.setContent(multipart);
}
Transport.send(msg);
JOptionPane.showMessageDialog(rootPane, "uw bericht aan " + Mail_aan.getText() + " is verzonden") ;
} catch (MessagingException mex)
{
System.out.println("VERSTUREN MISLUKT FOUT BIJ : " + mex);
}
}
@Action
public void attach() throws SqlJetException, MessagingException
{
int y=1;
final JFileChooser kiesattachment = new JFileChooser();
kiesattachment.setBounds(0,0,400,400);
for (i = 0 ; i <=5; i++)
{
kiesattachment.setVisible(rootPaneCheckingEnabled);
int attach = kiesattachment.showDialog(Mail.this, "Voeg toe");
attachlijst.add(i, kiesattachment.getSelectedFile());
y++;
JDialog.setDefaultLookAndFeelDecorated(true);
int response = JOptionPane.showConfirmDialog(null, "Wilt u nog een bijlage toevoegen?", "Confirm",
JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE);
if (response == JOptionPane.NO_OPTION)
{
jList1.setModel(attachlijst);
i=6;
} else if (response == JOptionPane.YES_OPTION) {
}
else if (response == JOptionPane.CLOSED_OPTION) {
System.out.println("");
}
