Using Email Transport to send e-mail
In this recipe, we will show how the Email Transport can be used to send e-mails. We will first implement a business service, which sends a message to a given e-mail address. The e-mail address is hardcoded in the endpoint of the business service.
In order to make the sending more flexible, we will also show how to use the Transport Headers action to dynamically set the e-mail address, the subject, and the mail body in a proxy service, before invoking the business service.
Getting ready
Make sure that the mail server is installed and configured as shown in the Using Email Transport to consume e-mails recipe.
How to do it...
First we will create the SMTP Server object, holding the reference to the SMTP server. In Eclipse OEPE, perform the following steps:
Add a new SMTP Server to the configuration project and name it
SMTPServer
.Enter
localhost
in the Server URL field.Enter
osbuser
into the User Name field.Enter
osbuser
into the Password and Confirm Password...