Monday, April 12, 2010

Email Notification for Announcements portlet.

Configure users setting.
Go to Control Panel > Users

Edit users with assigning them Guest community, and Announcement.

Configure Server Administration (Control Panel > Server Administration)

For outgoing port, use port 2525

Then add this properties in portal-ext.properties
announcements.email.from.address=webmaster@mysolution.net
announcements.email.from.name=Webmaster

Problem statement and Solution

The current email_body.tmpl is very simple.




Sometimes, we need to modify it so that the message becomes formal (Official).
Example,




How to modify email_body.tmpl in Announcements portlet?

In liferay Enterprise Edition (Liferay EE), email_body.tmpl located in folder dependencies.
Path: ~/html/portlet/announcements/WEB-INF/classes/com/liferay/portlet/announcements/dependencies

For those who use liferay Community Edition (Liferay CE), this file can be found in liferay-portal-src-5.2.3
Path: liferay-portal-src-5.2.3/portal-impl/src/com/liferay/portlet/announcements/dependencies

Then we need to do ant deploy in ext-impl. Copy email_body.tmpl and paste in ~/ext/ext-impl/src/com/liferay/portlet/announcements/dependencies
Notes that we need to create folders announcements and dependencies if they not existed.

Go to ~/ext/ext-impl
Then run command: ant deploy

Testing an announcement.

1. Add annoucement portlet in admin page (or any page).
2. Write your announcement.





Output