Skip to Main Content

import org.apache.commons.mail is not accessible

Carlos_ESADec 1 2022 — edited Dec 5 2022

Hi All,
I´m using Eclipse IDE for Enterprise Java and Web Developers, Version (2022-09 (4.25.0)) and I´m trying to create a simple package to send an email.
I have downloaded the below jar files and imported them as External Jar Files in the Build Path Configuration:
commons-email-1.5
commons-lang3-3.12.0
javax.mail
After that i have paste the below code:
The issue i´m facing is that the import lines are not accessible. The lines with (in red line) are the lines with issues.
I really appretiate any help. I am still trying to fox the issue but not getting success.

package bibliotecaemail;
import org.apache.commons.mail.DefaultAuthenticator; (in red line)
import org.apache.commons.mail.Email; (in red line)
import org.apache.commons.mail.SimpleEmail; (in red line)

public class UsandoBibliotecaEmail {
public static void main(String[] args) {
Email email = new SimpleEmail(); (in red line)
email.setHostName("smtp.googlemail.com");
email.setSmtpPort(465);
email.setAuthenticator(new DefaultAuthenticator("username", "password")); (in red line)
email.setSSLOnConnect(true);
email.setFrom("user@gmail.com");
email.setSubject("TestMail");
email.setMsg("This is a test mail ... :-)");
email.addTo("foo@bar.com");
email.send();
}
}

image.png
Thanks
Carlos ESA

Comments
Post Details
Added on Dec 1 2022
0 comments
68 views