Skip to content

Instantly share code, notes, and snippets.

View kashua14's full-sized avatar
🏠
Working from home

Kasasira Joshua kashua14

🏠
Working from home
View GitHub Profile
@kashua14
kashua14 / LoginVerification.java
Created August 31, 2021 07:16
How to login into an email using the Java Mail API.
public boolean checkEmailCrendentails(String hostName, String email, String password) {
Properties props = new Properties();
props.put("mail.smtp.auth", "true");
props.put("mail.smtp.starttls.enable", "true");
props.put("mail.smtp.host", hostName);
props.put("mail.smtp.port", "25");
Session session = Session.getInstance(props, new javax.mail.Authenticator() {
protected PasswordAuthentication getPasswordAuthentication() {