return true; } catch (SendFailedException sfe) { showFailedException(sfe); } return false;
   public void send() throws Exception, AddressException, MessagingException {//      try {         if(!loadConfig(configFile))            return;         Session session = Session.getDefaultInstance(SMTPProperties, null);         session.setDebug(false);         // create the Multipart and its parts to it         Multipart mp = new MimeMultipart();         Message msg = new MimeMessage(session);         InternetAddress[] toAddrs = null, ccAddrs = null;         toAddrs = InternetAddress.parse(to, false);         msg.setRecipients(Message.RecipientType.TO, toAddrs);         if (cc != null) {            ccAddrs = InternetAddress.parse(cc, false);            msg.setRecipients(Message.RecipientType.CC, ccAddrs);         }         if (subject != null)            msg.setSubject(subject.trim());         if (from != null && from.length() > 0)            msg.setFrom(new InternetAddress(from));         if (message != null && message.length() > 0) {            // create and fill the attachment message part            MimeBodyPart mbp = new MimeBodyPart();            mbp.setText(message,"us-ascii");            mp.addBodyPart(mbp);         }         msg.setSentDate(new Date());         if (attachment != null && attachment.length() > 0) {            // create and fill the attachment message part            MimeBodyPart abp = new MimeBodyPart();            abp.setText(attachment,"us-ascii");            if (attachmentName == null || attachmentName.length() == 0)               abp.setFileName("tn5250j.txt");            else               abp.setFileName(attachmentName);            mp.addBodyPart(abp);         }         if (fileName != null && fileName.length() > 0) {            // create and fill the attachment message part            MimeBodyPart fbp = new MimeBodyPart();            fbp.setText("File sent using tn5250j","us-ascii");            if (attachmentName == null || attachmentName.length() == 0)               fbp.setFileName("tn5250j.txt");            else               fbp.setFileName(attachmentName);             // Get the attachment             DataSource source = new FileDataSource(fileName);             // Set the data handler to the attachment             fbp.setDataHandler(new DataHandler(source));            mp.addBodyPart(fbp);         }         // add the Multipart to the message         msg.setContent(mp);         // send the message         Transport.send(msg);//      }//      catch (SendFailedException sfe) {//         System.out.println("Send Failed Exception " + sfe.toString());//         JOptionPane.showMessageDialog(parent,//                                          LangTool.getString("em.confirmationMessage") +//                                          " " + tot.getText(),//                                          LangTool.getString("em.titleConfirmation"),//                                          JOptionPane.INFORMATION_ERROR);//////      }//      catch (Exception mex) {//         System.out.println(mex.toString());//      }   }