Sending emails is a very common requirement in a web application. There are several methods you can choose from, each with varying levels of complexity and power.
ERJavaMail is part of Project Wonder and provides an API for sending component-based emails. ERJavaMail also uses the JavaMail API's underneath, but it includes the jars inside its framework, so you don't need to manually install JavaMail to use it. Because it does not have any external dependencies on other Project Wonder frameworks, you can use it without bringing in any other Project Wonder frameworks. For more information on ERJavaMail, see the ERJavaMail page.
JavaMail is Sun's API definition and open-source reference implementation of various methods of sending and receiving mail. All of the other WO mail-sending techniques are based on JavaMail, but you can choose to use it directly rather than use the higher level API's described below. If you would like to use JavaMail on your own, you will need to download and install the following jars and put them into your WOA's classpath:
You really should use ERJavaMail, WOMailDelivery is not as flexible as ERJavaMail is.
Built into WebObjects is the WOMailDelivery class. It provides a very simple API for sending mails, but lacks the power of Project Wonder's version. To use WOMailDelivery, you will need to set your SMTP server in one of the following ways:
Refer to the WOMailDelivery API for more information, but to simply send an email, you can use the following command:
WOMailDelivery.sharedInstance().composePlainTextEmail( fromAddress, toAddresses, bccAddresses, subject, body, WOMailDelivery.SEND_NOW );
By default, WOMailDelivery with use Sun's old SMTP implementation. However, if you install JavaMail (as described above) into your WOA or /Library/WebObjects/Extensions, WOMailDelivery will use it instead.