Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- final String username = "email@gmail.com";
- final String password = "pass";
- Properties props = new Properties();
- props.put("mail.smtp.auth", "true");
- props.put("mail.smtp.starttls.enable", "true");
- props.put("mail.smtp.host", "smtp.gmail.com");
- props.put("mail.smtp.port", "587");
- Session session = Session.getInstance(props,
- new javax.mail.Authenticator() {
- protected PasswordAuthentication getPasswordAuthentication() {
- return new PasswordAuthentication(username, password);
- }
- });
- try {
- Message message = new MimeMessage(session);
- message.setFrom(new InternetAddress("Chas3down@gmail.com"));
- message.setRecipients(Message.RecipientType.TO,
- InternetAddress.parse("2489248259@vtext.com"));
- message.setSubject("");
- message.setText("test1");
- Transport.send(message);
- log("sent msg");
- } catch (MessagingException e) {
- throw new RuntimeException(e);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement