Guest User

Untitled

a guest
Oct 25th, 2017
431
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.15 KB | None | 0 0
  1. String nome=request.getParameter("nome");
  2. String email=request.getParameter("email");
  3. String tel=request.getParameter("tel");
  4. String message=request.getParameter("mens");
  5.  
  6. EnviarMail mail=new EnviarMail();
  7. mail.enviar(nome,email,tel,message);
  8.  
  9.  
  10. RequestDispatcher rd=request.getRequestDispatcher("confirm.jsp");
  11. rd.forward(request, response);
  12.  
  13. }
  14.  
  15. public EnviarMail(){
  16.  
  17.  
  18. }
  19.  
  20.  
  21. public void enviar(String nome,String email,String tel,String msg){
  22.  
  23. SimpleEmail newemail=new SimpleEmail();
  24.  
  25. newemail.setHostName("smtp.gmail.com");
  26. newemail.setSmtpPort(465);
  27.  
  28. try {
  29.  
  30. newemail.setFrom("artgio32@gmail.com");
  31. newemail.addTo("acesarrocha3@hotmail.com");
  32. newemail.setSubject("ContatoFaleConosco");
  33. newemail.setMsg(nome);
  34. newemail.setMsg(email);
  35. newemail.setMsg(tel);
  36. newemail.setMsg(msg);
  37. newemail.setSSLOnConnect(true);
  38. newemail.setAuthentication("artgio32@gmail.com","081020731");
  39. newemail.setDebug(true);
  40. newemail.send();
  41.  
  42.  
  43. } catch (EmailException ex) {
  44. Logger.getLogger(EnviarMail.class.getName()).log(Level.SEVERE, null, ex);
  45. }
  46.  
  47.  
  48. }
Add Comment
Please, Sign In to add comment