Skip to content

Commit

Permalink
Update bomber.java
Browse files Browse the repository at this point in the history
  • Loading branch information
jdleo authored Feb 15, 2017
1 parent 04ccb1b commit 0760f6a
Showing 1 changed file with 61 additions and 1 deletion.
62 changes: 61 additions & 1 deletion Java Version/bomber.java
Original file line number Diff line number Diff line change
@@ -1 +1,61 @@
//
import java.io.UnsupportedEncodingException;
import java.util.Date;
import java.util.Properties;

import javax.activation.*;
import javax.mail.*;
import javax.mail.internet.InternetAddress;
import javax.mail.internet.MimeMessage;

public class bomber {

public static void main(String[] args) {


}

}

class EmailClient {
private String myEmail, myPassword;

public EmailClient(String myEmail, String myPassword) {
super();
this.myEmail = myEmail;
this.myPassword = myPassword;
}

public void send(String toEmail, String subjectMsg, String msg, int amount) {
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() {
PasswordAuthentication pA = new PasswordAuthentication(myEmail, myPassword);
return pA;

}
});

try {

Message message = new MimeMessage(session);
message.setFrom(new InternetAddress(myEmail));
message.setRecipients(Message.RecipientType.TO,
InternetAddress.parse(toEmail));
message.setSubject(subjectMsg);
message.setText(msg);

for(int i = 0;(i <= amount);i++) {
Transport.send(message);
}

} catch (MessagingException e) {
throw new RuntimeException(e);
}
}
}

0 comments on commit 0760f6a

Please sign in to comment.