com.qindesign.servlet
Class SendMailServlet
java.lang.Object
javax.servlet.GenericServlet
javax.servlet.http.HttpServlet
com.qindesign.servlet.SendMailServlet
- All Implemented Interfaces:
- Serializable, Servlet, ServletConfig
public class SendMailServlet
- extends HttpServlet
Example servlet that processes POST requests to mail things. This uses the
mailTo initialization parameter.
- Version:
- 1.0.4
- Author:
- Shawn Silverman
- See Also:
- Serialized Form
|
Method Summary |
protected void |
doPost(HttpServletRequest req,
HttpServletResponse resp)
This method will be called when a mail request is posted to this
servlet. |
void |
init()
Checks the "mailTo" initialization parameter for the target email
address. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
SendMailServlet
public SendMailServlet()
init
public void init()
throws ServletException
- Checks the "mailTo" initialization parameter for the target email
address. All emails will be sent to this address.
- Overrides:
init in class GenericServlet
- Throws:
ServletException - if this parameter is not set.
doPost
protected void doPost(HttpServletRequest req,
HttpServletResponse resp)
throws ServletException,
IOException
- This method will be called when a mail request is posted to this
servlet.
Certain request properties are of interest:
from is the sender's email address.
subject will place a subject on the email.
content is the email content.
nextPath tells this servlet where to forward the
request once the mail has been sent. Keep in mind that the request
has the "POST" method, and so nextPath will be called
with a "POST" as well.
- Overrides:
doPost in class HttpServlet
- Throws:
ServletException
IOException
© 2001-2007 Shawn Silverman