Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ssl/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 获取电子邮件内容时出错_Java_Jakarta Mail_Imap_Multipart - Fatal编程技术网

Java 获取电子邮件内容时出错

Java 获取电子邮件内容时出错,java,jakarta-mail,imap,multipart,Java,Jakarta Mail,Imap,Multipart,我已经编写了获取多部分电子邮件内容的代码…我收到了此错误…我知道此错误是由于一些非常愚蠢的原因造成的,但经过数小时的调试后我无法获得它…可能是一些愚蠢的错误,如;,}等 代码: 我得到这个错误: FolderFetch3.java:17: error: class, interface, or enum expected private String getText(Part p) throws MessagingException, IOException {

我已经编写了获取多部分电子邮件内容的代码…我收到了此错误…我知道此错误是由于一些非常愚蠢的原因造成的,但经过数小时的调试后我无法获得它…可能是一些愚蠢的错误,如;,}等 代码:

我得到这个错误:

FolderFetch3.java:17: error: class, interface, or enum expected
    private String getText(Part p) throws MessagingException, IOException {
            ^
FolderFetch3.java:23: error: class, interface, or enum expected
            String text = null;
            ^
FolderFetch3.java:24: error: class, interface, or enum expected
            for (int i = 0; i < mp.getCount(); i++) {
            ^
FolderFetch3.java:24: error: class, interface, or enum expected
            for (int i = 0; i < mp.getCount(); i++) {
                            ^
FolderFetch3.java:24: error: class, interface, or enum expected
            for (int i = 0; i < mp.getCount(); i++) {
                                               ^
FolderFetch3.java:26: error: class, interface, or enum expected
                if (bp.isMimeType("text/plain")) {
                ^
FolderFetch3.java:29: error: class, interface, or enum expected
                    continue;
                    ^
FolderFetch3.java:30: error: class, interface, or enum expected
                } else if (bp.isMimeType("text/html")) {
                ^
FolderFetch3.java:32: error: class, interface, or enum expected
                    if (s != null)
                    ^
FolderFetch3.java:34: error: class, interface, or enum expected
                } else {
                ^
FolderFetch3.java:36: error: class, interface, or enum expected
                }
                ^
FolderFetch3.java:39: error: class, interface, or enum expected
        } else if (p.isMimeType("multipart/*")) {
        ^
FolderFetch3.java:41: error: class, interface, or enum expected
            for (int i = 0; i < mp.getCount(); i++) {
            ^
FolderFetch3.java:41: error: class, interface, or enum expected
            for (int i = 0; i < mp.getCount(); i++) {
                            ^
FolderFetch3.java:41: error: class, interface, or enum expected
            for (int i = 0; i < mp.getCount(); i++) {
                                               ^
FolderFetch3.java:43: error: class, interface, or enum expected
                if (s != null)
                ^
FolderFetch3.java:45: error: class, interface, or enum expected
            }
            ^
FolderFetch3.java:48: error: class, interface, or enum expected
        { return p.getContent().toString();}  
                                           ^
FolderFetch3.java:50: error: class, interface, or enum expected
} 
^

将getTextPart p方法放在FolderFetch3类中

FolderFetch3.java:17: error: class, interface, or enum expected
    private String getText(Part p) throws MessagingException, IOException {
            ^
FolderFetch3.java:23: error: class, interface, or enum expected
            String text = null;
            ^
FolderFetch3.java:24: error: class, interface, or enum expected
            for (int i = 0; i < mp.getCount(); i++) {
            ^
FolderFetch3.java:24: error: class, interface, or enum expected
            for (int i = 0; i < mp.getCount(); i++) {
                            ^
FolderFetch3.java:24: error: class, interface, or enum expected
            for (int i = 0; i < mp.getCount(); i++) {
                                               ^
FolderFetch3.java:26: error: class, interface, or enum expected
                if (bp.isMimeType("text/plain")) {
                ^
FolderFetch3.java:29: error: class, interface, or enum expected
                    continue;
                    ^
FolderFetch3.java:30: error: class, interface, or enum expected
                } else if (bp.isMimeType("text/html")) {
                ^
FolderFetch3.java:32: error: class, interface, or enum expected
                    if (s != null)
                    ^
FolderFetch3.java:34: error: class, interface, or enum expected
                } else {
                ^
FolderFetch3.java:36: error: class, interface, or enum expected
                }
                ^
FolderFetch3.java:39: error: class, interface, or enum expected
        } else if (p.isMimeType("multipart/*")) {
        ^
FolderFetch3.java:41: error: class, interface, or enum expected
            for (int i = 0; i < mp.getCount(); i++) {
            ^
FolderFetch3.java:41: error: class, interface, or enum expected
            for (int i = 0; i < mp.getCount(); i++) {
                            ^
FolderFetch3.java:41: error: class, interface, or enum expected
            for (int i = 0; i < mp.getCount(); i++) {
                                               ^
FolderFetch3.java:43: error: class, interface, or enum expected
                if (s != null)
                ^
FolderFetch3.java:45: error: class, interface, or enum expected
            }
            ^
FolderFetch3.java:48: error: class, interface, or enum expected
        { return p.getContent().toString();}  
                                           ^
FolderFetch3.java:50: error: class, interface, or enum expected
}