Advertisement
Guest User

javax SMS

a guest
Nov 11th, 2015
293
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.90 KB | None | 0 0
  1. [+] Simple Program : Java [+]
  2. * Send Text / SMS Bomber via Javax Mail
  3.  
  4. This could be I guess converted into a Java SMS bomber if you want to add a bit to the source.
  5.  
  6. You will need to add an External Jar "The javax.mail jar which can be found here:
  7. https://java.net/projects/javamail/pages/Home
  8.  
  9.  
  10. ====================================
  11.  
  12. import java.util.*;
  13. import javax.mail.*;
  14. import javax.mail.internet.*;
  15.  
  16. public class Main {
  17. //Using Gmail for this Entire Example
  18. private static String USER_NAME = "4nti@gmail.com"; // Gmail Username (example only)
  19. private static String PASSWORD = "YourPassword"; // GMail password (example only)
  20. private static String RECIPIENT = "PHONENUMBERHERE"; //Targets Phone number + Provider such as 1112223333@vtext.com (I'm Using Verizon as example)
  21.  
  22. public static void main(String[] args) {
  23. String from = USER_NAME;
  24. String pass = PASSWORD;
  25. String[] to = { RECIPIENT@gmail.com }; // list of recipient email address(es)
  26. String subject = "Subject Of Your Message";
  27. String body = "YourMessageHere"; // Message that will be Sent
  28.  
  29. sendFromGMail(from, pass, to, subject, body);
  30. }
  31.  
  32. private static void sendFromGMail(String from, String pass, String[] to, String subject, String body) {
  33. Properties props = System.getProperties();
  34. String host = "smtp.gmail.com"; //Using gmail for this example if you have your own setup you could use this to spam a persons phone
  35. props.put("mail.smtp.starttls.enable", "true");
  36. props.put("mail.smtp.host", host);
  37. props.put("mail.smtp.user", from);
  38. props.put("mail.smtp.password", pass);
  39. props.put("mail.smtp.port", "587"); //If you change from gmail they might use a different port
  40. props.put("mail.smtp.auth", "true");
  41.  
  42. Session session = Session.getDefaultInstance(props);
  43. MimeMessage message = new MimeMessage(session);
  44.  
  45. try {
  46. message.setFrom(new InternetAddress(from));
  47. InternetAddress[] toAddress = new InternetAddress[to.length];
  48.  
  49. // Getting the Array of Addresses
  50. for( int i = 0; i < to.length; i++ ) {
  51. toAddress[i] = new InternetAddress(to[i]);
  52. }
  53.  
  54. for( int i = 0; i < toAddress.length; i++) {
  55. message.addRecipient(Message.RecipientType.TO, toAddress[i]);
  56. }
  57.  
  58. message.setSubject(subject);
  59. message.setText(body);
  60. Transport transport = session.getTransport("smtp");
  61. transport.connect(host, from, pass);
  62. transport.sendMessage(message, message.getAllRecipients());
  63. transport.close();
  64. }
  65. catch (AddressException ae) {
  66. ae.printStackTrace();
  67. }
  68. catch (MessagingException me) {
  69. me.printStackTrace();
  70. }
  71. }
  72. }
  73.  
  74. ================
  75. -End-
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement