Advertisement
Guest User

Untitled

a guest
Apr 10th, 2017
566
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.82 KB | None | 0 0
  1. try {
  2. Process p = Runtime.getRuntime().exec(new String[]{
  3. "/usr/sbin/sendmail",
  4. "-t"
  5. });
  6. try (OutputStreamWriter os = new OutputStreamWriter(p.getOutputStream(), "UTF8")) {
  7. os.write("Content-Type: text/html\n");
  8. os.write("From: abc@gmail.com\n");
  9. os.write("To: abc@gmail.com\n");
  10. os.write("CC: abc@gmail.com\n");
  11. os.write("BCC: abc@gmail.com, abcd@gmail.com\n");
  12. os.write("Subject: This is subject\n");
  13. os.write("\n");
  14. os.write("Dear \n");
  15. os.write("This is just a example \n");
  16. }
  17. p.waitFor();
  18. } catch (IOException | InterruptedException e) {
  19. log.error(null, e);
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement