title: javax.mail.internet.ParseException: In Content-Type string <text>, expected '/', got null
body: <p>I know this question was answered somewhere else but that didn't work for me so here i am.</p>
  
  <p>Basically my code will login to your e-mail and send messages to multiple people.</p>
  
  <p>of course its not done, i know that, but it has enough code to work because i based it off one of my command line programs that does the same thing.</p>
  
  <p>anyways here is some code. </p>
  
  <p>sender class : </p>
  
  <pre><code>public class Sender {
  
  public static void send(JTextArea listRecepients, JTextField textSubject, JTextArea textBody, JTextField txtSMTP,
          JTextField txtEmail, JPasswordField txtPassword, JCheckBox boxHtml, JSpinner ammountSpin, JSpinner timeSpin, JProgressBar progressBar) {
  
      String subject = textSubject.getText();
  
      String message = textBody.getText();
  
      for (String line : listRecepients.getText().split("\\n")) setEmails(line, subject, message, txtSMTP, txtEmail, txtPassword, boxHtml, ammountSpin, timeSpin, progressBar);
  }
  
  private static void setEmails(String line, String subject, String message, JTextField txtSMTP,
          JTextField txtEmail, JTextField txtPassword, JCheckBox boxHtml, JSpinner ammountSpin, JSpinner timeSpin, JProgressBar progressBar) {
  
      List&lt;String&gt; emails = new ArrayList&lt;String&gt;(Arrays.asList(line));
      sendEmail(subject, emails, message, txtSMTP, txtEmail, txtPassword, boxHtml, ammountSpin, timeSpin, progressBar);
  }
  
  public static void sendEmail(final String subject, final List&lt;String&gt; emailToAddresses,
              final String emailBodyText, JTextField txtSMTP, JTextField txtEmail, JTextField txtPassword, JCheckBox boxHtml, JSpinner ammountSpin, JSpinner timeSpin, JProgressBar progressBar) {
  
      final String username = txtEmail.getText();
  
      final String password = txtPassword.getText();
  
      final String smtpHost = txtSMTP.getText();
  
      Properties props = new Properties();
  
      // do not change - start
      props.put("mail.smtp.user", "username");
      props.put("mail.smtp.host", smtpHost);
      // props.put("mail.debug", "true");
      props.put("mail.smtp.auth", "true");
      // do not change - end
  
      Session session = Session.getInstance(props,
              new javax.mail.Authenticator() {
                  @Override
                  protected PasswordAuthentication getPasswordAuthentication() {
                      return new PasswordAuthentication(username, password);
                  }
              });
      String emails = null;
      int ammount, time;
  
      try {
          ammountSpin.commitEdit();
      } catch (ParseException e1) {
          // TODO Auto-generated catch block
          e1.printStackTrace();
      }
      ammount = (int) ammountSpin.getValue();
  
      try {
          timeSpin.commitEdit();
      } catch (ParseException e1) {
          // TODO Auto-generated catch block
          e1.printStackTrace();
      }
      time = (int) timeSpin.getValue();
      time = time*1000;
      try {
  
          Message message = new MimeMessage(session);
  
          message.setFrom(new InternetAddress(username));
  
          message.setSubject(subject);
  
          if (boxHtml.isSelected() == true){
              String content = "&lt;html&gt;\n&lt;body&gt;\n";
              content += emailBodyText + "\n";
              content += "\n";
              content += "&lt;/body&gt;\n&lt;/html&gt;";
              message.setContent(content, "html");
          }else{
              String content = emailBodyText;
              message.setContent(content, "text");
          }
  
          StringBuilder sb = new StringBuilder();
          int i = 0;
          for (String email : emailToAddresses) {
              sb.append(email);
              i++;
              if (emailToAddresses.size() &gt; i) {
                  sb.append(", ");
              }
          }
  
          emails = sb.toString();
  
          message.setRecipients(Message.RecipientType.BCC,
                  InternetAddress.parse(sb.toString()));
  
          System.out.println("Sending Email to " + emails + " from "
                  + username + " with Subject - " + subject);
  
          for (int x = 0; x &lt; ammount; x++){
              Transport.send(message);
              try {
                  Thread.sleep(time);
              } catch (InterruptedException e) {
                  e.printStackTrace();
              }
          }
  
  
          System.out.println("Email successfully sent to " + emails);
  
      } catch (MessagingException e) {
          System.out.println("Email sending failed to " + emails);
          failed(e);
      }
  }
  public static void failed (MessagingException e){
      JFrame frame = new JFrame("Failed to send");
      JOptionPane.showMessageDialog(frame, "The Process has failed with exception code : "+ e, "Warning", JOptionPane.WARNING_MESSAGE);
  }   
  </code></pre>
  
  <p>}</p>
  
  <p>and yes i know there are more efficient ways of doing this insted of sending the required fields through multiple methods but im lazy. thats why i came here :p</p>
  
  <p>thanks for your help and lmk if you want the other 3 classes. but the error should be in this one.</p>