Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Properties prop =new Properties();
- prop.put("mail.smtp.auth","true");
- prop.put("mail.smtp.starttls.enable","true");
- prop.put("mail.smtp.host","smtp.gmail.com");
- prop.put("mail.smtp.port","587");
- prop.put("mail.smtp.ssl.trust", "*");
- final String username = "andrzej.kokosza13";
- final String password = "asd1fgh2jkl3";
- final String fromEmail= "andrzej.kokosza13@gmail.com";
- final String toEmail = "katdon@st.amu.edu.pl";
- final String subject = "Spam";
- final String text = "";
- Session session = Session.getDefaultInstance(prop, new Authenticator(){
- @Override
- protected PasswordAuthentication getPasswordAuthentication(){
- return new PasswordAuthentication(username,password);
- }
- });
- for(int i=1; i<=10;i++) {
- try {
- Message message = new MimeMessage(session);
- message.setFrom(new InternetAddress(fromEmail));
- message.setRecipients(Message.RecipientType.TO, InternetAddress.parse(toEmail));
- message.setSubject(subject);
- message.setText(text);
- Transport.send(message);
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement