The type javax.mail.Authenticator cannot be resolved

版权声明:本文为博主原创文章,未经博主允许不得转载。【huawangxin】 https://blog.csdn.net/huawangxin/article/details/73897110

引入如下代码时报错:
        Email email = new SimpleEmail();
        email.setHostName("smtp.googlemail.com");
        email.setSmtpPort(465);
        email.setAuthenticator(new DefaultAuthenticator("username", "password"));
        email.setSSLOnConnect(true);
        email.setFrom("[email protected]");
        email.setSubject("TestMail");
        email.setMsg("This is a test mail ... :-)");
        email.addTo("[email protected]");
        email.send();


报错信息:The type javax.mail.Authenticator cannot be resolved

猜你喜欢

转载自blog.csdn.net/huawangxin/article/details/73897110