解决方案 »

  1.   

     /**
     372:     * Return whether this helper is in multipart mode,
     373:     * i.e. whether it holds a multipart message.
     374:     * @see #MimeMessageHelper(MimeMessage, boolean)
     375:     */
     376:       public final boolean isMultipart() {
     377:        return (this.rootMimeMultipart != null);
     378:    }
     379:
     380:    /**
     381:     * Throw an IllegalStateException if this helper is not in multipart mode.
     382:     */
     383:       private void checkMultipart() throws IllegalStateException {
     384:           if (!isMultipart()) {
     385:            throw new IllegalStateException("Not in multipart mode - " +
     386:                "create an appropriate MimeMessageHelper via a constructor that takes a 'multipart' flag " +
     387:                "if you need to set alternative texts or add inline elements or attachments.");
     388:        }
     389:    }
     390:
      

  2.   

    你这样写只能发送文本邮件
    参考用javamail发送带附件的邮件 
      

  3.   

    你这样写是不能发送带附件的邮件的
    JavaMail发送邮件(带附件)(
      

  4.   

     MimeMessageHelper messageHelp = new MimeMessageHelper(message,encode); 
    改为
     MimeMessageHelper messageHelp = new MimeMessageHelper(message,true,encode); 
    就能了发了