20 April 2010

Sending Emails in 11 g




Sending e-mails is very easy in SOA 11g . Just follow these steps on server side :

1. Login SOA Enterprise Manager
(http://<hostname>:<port>/em)

2. Go to "SOA_INFRA" farm child of your domain
( farm_base_domain > SOA > soa-infra(soa_server1) )

3. Select "Workflow Notification Properties" as shown in diagram :
(soa_infra > SOA Infrastructure > SOA Administration > Workflow Notification Properties)



4. In the Workflow Notification Properties page , update notification mode to "Email"

5. Update email IDs if needed. Note that Actionable Address and Reply-To Address need to be different



6. Click Apply to save the changes.
(This does not actually "apply" the changes.. a managed server bounce is necessary )
If you are using SOA R1 (11.1.1.1) , then it has a notification workflow file named workflow-notification-config.xml.
The file is located at
<MIDDLEWARE_HOME>\user_projects\domains\config\soa-infra\configuration
Note that whatever changes you make get reflected in this file.

7. After clicking apply, click the link which reads "Go to the Messaging Driver Page"

On this page click configure driver button which will take you to User Messaging Email Driver page.
This can also be navigated through
farm_base_domain>SOA>User Messaging Service>usermessagingdriver-email (soa_server1)






8. On this page go to section with heading "Driver-Specific Configuration" . Change values for following properties :
1) OutgoingMailServer (mandatory )
2) OutgoingMailServerPort (mandatory , default : 25)
3) OutgoingMailServerSecurity (optional , default : none)
4) OutgoingUsername (optional , required only if SMTP authentication is mandatory)
5) OutgoingPassword (optional , required only if SMTP authentication is mandatory)

9. Click "Apply" to save the properties.

10. Restart the Managed SOA Server.


Server side changes are done.
Now simply create a new composite with a BPEL process. Add Email activity from the "BPEL Activities and Components" palette
It will open a window to enter details like email id , subject , body. Complete the activity and deploy the project.


Sending emails from pre-configured accounts.

When you open the email activity , you can see that "From Account" has value 'default'.
This value internally corresponds to the from-email address you configured in step 5 above.
In order to send email from some other account , all we need to do is add a entry in the workflow-notification-config.xml.
So open this file (location is :
"<MIDDLEWARE_HOME>\user_projects\domains\config\soa-infra\configuration"
as mentioned above)

Add another entry as shown in the snapshot :





Note that these changes are picked up on run-time and the bounce is not required. Also verify that the command propmpt window for managed server shows some 5-6 messages like :
" INFO: FabricConfigManager.documentChanged DOCUMENT CHANGED: config/soa-infra/configuration/workflow-notification-config.xml "

Once the change is done, then you can use the name used in ASNSConfiguration ('Test ' in the snapshot above) as the value for " From Account" in Email activity.




1 comment:

Ranjit Singh said...

Hi
I have "From Account" value coming in email payload .How can I override From Account coming from workflow notification service.Please suggest.