[code]<%@ page language=“java” contentType=“text/html; charset=ISO-8859-1”
pageEncoding=“ISO-8859-1”%>
Nome | |
[code]import org.apache.commons.mail.EmailException;
import org.apache.commons.mail.SimpleEmail;
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public class Teste extends HttpServlet {
private static final long serialVersionUID = 1L;
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
doPost(request, response);
}
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
String a = request.getParameter("nome");
String b = request.getParameter("email");
System.out.println(a);
SimpleEmail email = new SimpleEmail();
try {
email.setDebug(true);
email.setHostName("smtp.gmail.com");
email.setAuthentication("*****","*******");
email.setSmtpPort(465);
email.setSSL(true);
email.addTo("eu@hotmail.com");
email.setFrom("eu@gmail.com");
email.setSubject("Teste");
email.setMsg(a);
email.setMsg(b);
email.send();
} catch (EmailException e) {
System.out.println(e.getMessage());
}
}
}
[/code]
O q q esta errado??
Mt obrigado