Sending Email from Within JSPs
In the previous chapter, you learned to trap unchecked exceptions using error pages. Error pages allowed you to exit gracefully from such situations. You should inform the technical staff about an error when it occurs.
There are numerous ways you can send email from within your Java application or JSP:
Invoking an external program, such as sendmail, and passing the email information as command-line arguments. This is not a 100% pure Java solution for sending email and will not necessarily work on another platform. It also requires that you have the sendmail application configured on your host:
try { String args[] = { "sendmail", "from@auction.station.net", "to@auction.station.net", "\"Send Message using Native ...
Get Java Server Pages from scratch now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.