One: The condition must be downloaded by Sun's JavaMail API package, address is: http://java.sun.com/products/javaMail/ I use the 1.2 version here, add the associated package (JAR file) to the ClassPath 2: The program is very simple, do not need us to consider things of many formations, because the API helps us do these things, below is a simple email servlet: (For familiar people, I am afraid it is just simple. a servlet) import java.io *;. import javax.servlet *;. import javax.servlet.http *;. import sun.net.smtp *;. public class SendMailServlet extends HttpServlet {public static String MAIL_FROM = "from"; public static String MAIL_TO = "to"; public static String MAIL_SUBJECT = "subject"; public static String MAIL_BODY = "body"; public static String MAIL_HOST = "mailhost"; public void doGet (HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {Resp.setContentType ("text / html; charSet = GB2312"); PrintWriter out = Resp.GetWriter (); out.println ("