<tfoot id='VmeJd'></tfoot>

    1. <small id='VmeJd'></small><noframes id='VmeJd'>

      <legend id='VmeJd'><style id='VmeJd'><dir id='VmeJd'><q id='VmeJd'></q></dir></style></legend>
    2. <i id='VmeJd'><tr id='VmeJd'><dt id='VmeJd'><q id='VmeJd'><span id='VmeJd'><b id='VmeJd'><form id='VmeJd'><ins id='VmeJd'></ins><ul id='VmeJd'></ul><sub id='VmeJd'></sub></form><legend id='VmeJd'></legend><bdo id='VmeJd'><pre id='VmeJd'><center id='VmeJd'></center></pre></bdo></b><th id='VmeJd'></th></span></q></dt></tr></i><div id='VmeJd'><tfoot id='VmeJd'></tfoot><dl id='VmeJd'><fieldset id='VmeJd'></fieldset></dl></div>

        <bdo id='VmeJd'></bdo><ul id='VmeJd'></ul>

      使用 commons-email-1.3 发送电子邮件时出错

      Error in sending email using commons-email-1.3(使用 commons-email-1.3 发送电子邮件时出错)
    3. <small id='b9qMr'></small><noframes id='b9qMr'>

          <tfoot id='b9qMr'></tfoot>

          <legend id='b9qMr'><style id='b9qMr'><dir id='b9qMr'><q id='b9qMr'></q></dir></style></legend>
            <tbody id='b9qMr'></tbody>
          <i id='b9qMr'><tr id='b9qMr'><dt id='b9qMr'><q id='b9qMr'><span id='b9qMr'><b id='b9qMr'><form id='b9qMr'><ins id='b9qMr'></ins><ul id='b9qMr'></ul><sub id='b9qMr'></sub></form><legend id='b9qMr'></legend><bdo id='b9qMr'><pre id='b9qMr'><center id='b9qMr'></center></pre></bdo></b><th id='b9qMr'></th></span></q></dt></tr></i><div id='b9qMr'><tfoot id='b9qMr'></tfoot><dl id='b9qMr'><fieldset id='b9qMr'></fieldset></dl></div>
            <bdo id='b9qMr'></bdo><ul id='b9qMr'></ul>

                本文介绍了使用 commons-email-1.3 发送电子邮件时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                发送电子邮件时,我使用 commons-email-1.3 收到以下错误.
                我已经下载并添加了外部 jar 到项目中.
                请帮我解决这个问题!

                While sending email I am getting the following errors using commons-email-1.3.
                I have downloaded and added external jar's to the project.
                Please help me fix this problem!

                package mypkg;
                
                import org.apache.commons.mail.DefaultAuthenticator;
                import org.apache.commons.mail.Email;
                import org.apache.commons.mail.SimpleEmail;
                
                public class sendingmail {
                     public static void main(String[] args)  throws Exception {
                            Email email = new SimpleEmail();
                            email.setSmtpPort(587);
                            email.setAuthenticator(new DefaultAuthenticator("myid","mypwd")); //Here is the error
                            email.setDebug(false);
                            email.setHostName("smtp.gmail.com");
                            email.setFrom("me@gmail.com");
                            email.setSubject("Hi");
                            email.setMsg("This is a test mail ... :-)");
                            email.addTo("you@gmail.com");
                            email.setTLS(true);
                            email.send();
                            System.out.println("Mail sent!");
                
                    }
                }
                

                给出错误的行是

                email.setAuthenticator(new DefaultAuthenticator("myid","mypwd"));
                

                错误信息是

                线程main"java.lang.Error 中的异常:未解决的编译问题:

                Exception in thread "main" java.lang.Error: Unresolved compilation problems:

                无法解析类型 javax.mail.Authenticator.它是从所需的 .class 文件中间接引用的
                来自类型 Email 的方法 setAuthenticator(Authenticator) 指的是 mypkg.mailtest.main(mailtest.java:13) 处缺少的类型 Authenticator

                The type javax.mail.Authenticator cannot be resolved. It is indirectly referenced from required .class files
                The method setAuthenticator(Authenticator) from the type Email refers to the missing type Authenticator at mypkg.mailtest.main(mailtest.java:13)

                推荐答案

                请从指定链接下载jar

                Please download the jars from the specified links

                激活JAR

                Java Mail jar

                这篇关于使用 commons-email-1.3 发送电子邮件时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                相关文档推荐

                Compiling C++ for the JVM(为 JVM 编译 C++)
                Compile to java bytecode (without using Java)(编译成java字节码(不使用Java))
                How to drive C#, C++ or Java compiler to compute 1+2+3+...+1000 at compile time?(如何在编译时驱动 C#、C++ 或 Java 编译器计算 1+2+3+...+1000?)
                Java ClassLoader: load same class twice(Java ClassLoader:两次加载相同的类)
                How to debug .class files in ECLIPSE?(如何在 ECLIPSE 中调试 .class 文件?)
                Java quot;The blank final field may not have been initializedquot; Anonymous Interface vs Lambda Expression(Java“可能尚未初始化空白的最终字段匿名接口与 Lambda 表达式)

                      <tbody id='0uf84'></tbody>

                      <small id='0uf84'></small><noframes id='0uf84'>

                        <tfoot id='0uf84'></tfoot>
                        <i id='0uf84'><tr id='0uf84'><dt id='0uf84'><q id='0uf84'><span id='0uf84'><b id='0uf84'><form id='0uf84'><ins id='0uf84'></ins><ul id='0uf84'></ul><sub id='0uf84'></sub></form><legend id='0uf84'></legend><bdo id='0uf84'><pre id='0uf84'><center id='0uf84'></center></pre></bdo></b><th id='0uf84'></th></span></q></dt></tr></i><div id='0uf84'><tfoot id='0uf84'></tfoot><dl id='0uf84'><fieldset id='0uf84'></fieldset></dl></div>
                          <bdo id='0uf84'></bdo><ul id='0uf84'></ul>

                          <legend id='0uf84'><style id='0uf84'><dir id='0uf84'><q id='0uf84'></q></dir></style></legend>