Guest User

Untitled

a guest
Aug 11th, 2018
186
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 5 0.55 KB | None | 0 0
  1. package de.dwerth.sendmail;
  2.  
  3. import java.util.Properties;
  4. import javax.mail.PasswordAuthentication;
  5.  
  6. public class SMTPAuthenticator extends javax.mail.Authenticator {
  7.  
  8.     private Properties props;
  9.  
  10.     public SMTPAuthenticator(Properties props) {
  11.         this.props = props;
  12.     }
  13.  
  14.     public PasswordAuthentication getPasswordAuthentication() {
  15.         String username = props.getProperty("mail.smtp.user");
  16.         String password = props.getProperty("mail.smtp.password");
  17.         return new PasswordAuthentication(username, password);
  18.     }
  19. }
Add Comment
Please, Sign In to add comment