Liferay Mail and SMS Text Messenger Portlet

Exclusive offer: get 50% off this eBook here
Liferay Portal Enterprise Intranets

Liferay Portal Enterprise Intranets — Save 50%

A practical guide to building a complete corporate intranet with Liferay

$35.99    $18.00
by Jonas X. Yuan | March 2009 | Content Management Java Open Source

As an administrator of an intranet website, you are required to provide an environment for employees to enjoy mailing, SMS text messaging with others. In this article by Jonas X. Yuan, we will discuss how to manage emails and then focus on SMS text messenger.

In this article we will learn how to:

  • Manage (check, delete, forward, reply, search) mails.
  • Set up mail portlet.
  • Manage SMS text messenger portlet.

Working with Mail Portlet

For the purpose of this article, we will use an intranet website called book.com  which is created  for a fictions company named "Palm Tree Publications".

In order to let employees manage their emails, we can use the Liferay Mail portlet. As an administrator of "Palm Tree Publications", you need to create a Page called "Mail" under the Page, "Community" at the Book Lovers Community Public Pages and also add the Mail portlet in the Page, "Mail".

Experiencing Mail Management

First of all, login as "Palm Tree". Then, let's do the above as follows:

  1. Add a Page called "Mail" under the Page "Community" at the Book Lovers Community Public Pages, if the Page is not already present.
  2. If the Mail portlet is not already present, add it in the Page, "Mail" of the Book Lovers Community where you want to manage mails. You will see the Mail portlet as shown in the following figure.

Liferay Portal Enterprise Intranets

Let's assume that we set up the mail domain as "cignex.com" in the Enterprise Admin portlet for testing purposes, as we have a mail engine with this mail domain already. Of course, you could set up the mail domain as "book.com", or something else, if you had a mail engine with this mail domain in your hand.

As an editor of the editorial department, "Lotti Stein", you may want to manage your mails in the mail domain, "cignex.com". You can first choose a user name for your personal company the email address, say "admin1234" and register. Let's do it as follows:

  1. Login as "Lotti Stein".
  2. Go to the Page "Mail" under the Page, "Community", at the Book Lovers community Public Pages.
  3. Locate the Mail portlet.
  4. Input the value for User name as "admin1234".
  5. Click the Register button.

Your new email address is "admin1234@cignex.com". This email address will also serve as your login, as shown in the following figure.

Liferay Portal Enterprise Intranets

You can now check for new messages in your inbox, by clicking the Inbox link first. Then, you can view the Unread messages, and either Check Mail or create a New mail, as shown in the following figure:

Liferay Portal Enterprise Intranets

You can go to the Page of Mail management by clicking on any link of Unread Messages, or Check Mail button or New button. Further, you can manage emails through the Mail portlet of your current account. Email management includes the following features (as shown in the following figure):

  • Create a New email.
  • Check Mail.
  • Reply to an email.
  • Reply All emails.
  • Forward emails.
  • Delete emails.
  • Print emails, and
  • Search.

Liferay Portal Enterprise Intranets

Note that the first email with the subject, "Users in Staging server", is sent through the SMS Text Messenger portlet. For more details, refer to the forthcoming section.

How to Set up Mail Server?

In order to make the Mail portlet work, we have to set up a mail server with IMAP, POP and SMTP protocols. Suppose that the Enterprise "Palm Tree Publications" has a mail server with the domain "exg3.exghost.com", an account "admin@cignex.com/admin1234", and protocol IMAP, POP and SMTP. As an administrator, you need to integrate this mail server with IMAP, POP and SMTP protocol in Liferay. Let's do it as follows:

  1. Find the file ROOT.xml in $TOMCAT_DIR/conf/Catalina/localhost.
  2. Find the mail configuration first.
  3. Then configure it as follows:
      <!-- Mail -->
      <Resource
      name="mail/MailSession"
      auth="Container"
      type="javax.mail.Session"
      mail.imap.host="exg3.exghost.com"
      mail.imap.port="143"
      mail.pop.host="exg3.exghost.com"
      mail.pop.port="110"
      mail.store.protocol="imap"
      mail.transport.protocol="smtp"
      mail.smtp.host="exg3.exghost.com"
      mail.smtp.port="2525"
      mail.smtp.auth="true"
      mail.smtp.starttls.enable="true"
      mail.smtp.user="admin@cignex.com"
      password="admin1234"
      mail.smtp.socketFactory.class="javax.net.ssl.SSLSocketFactory"
      />

In short, a Mail portlet is an AJAX web-mail client. We can configure it to work with any mail server. It reduces page refreshes, since it displays message previews and message lists in a dual pane window.

How to Set up Mail Portlet?

If you have proper Permissions, you can change the preferences of the Mail portlet. To change the preferences, you can simply click the Preferences icon to the upper right of the Mail portlet.

With the Recipients tab selected, you can find potential recipients from the Directory (Enabled or Disabled) and the Organization (My Organization or All Available). Click the Save button after making any changes.

Using the Filters tab, you can set the values to filter emails associated with an email address to a Folder. Click the Save button after making any changes.

Note that the maximum number of email addresses is ten. This number is also configurable at the portal-ext.properties

Similarly, the Forward Address tab allows all emails to be forwarded to the email address you want. Enter one email address Per Line. Remove all entries to disable email forwarding. Select Yes to leave, or No to not leave a copy of the forwarded message. Click the Save button after making any changes.

Further, the Signature tab also allows you to set up your signature using HTML text editor. The signature you have set up will be added to each outgoing message. Click the Save button after making any changes.

The Vacation Message tab allows you to set up vacation messages using HTML text editor. The vacation message notifies others of your absence (as shown in the following figure). Click the Save button after making any changes.

Liferay Portal Enterprise Intranets

Liferay Portal Enterprise Intranets A practical guide to building a complete corporate intranet with Liferay
Published: April 2008
eBook Price: $35.99
Book Price: $59.99
See more
Select your format and quantity:

Using Permissions

The following table shows Permissions for the Mail portlet. A Community User can set up all Permissions (marked ‘X') while a Guest User has the View, Configuration and Preferences Permissions. By default, a Community (marked ‘*') as well as a Guest User has View action.

Action

Description

Community

Guest

View

Views this portlet

X, *

X, *

Configuration

Configures Permissions of this portlet

X

X

Preferences

Configures mail setting of this portlet

X

X

Obviously, as a User of the Book Lovers Community, "Lotti Stein" has only View Permissions on the Mail portlet, by default. Since the Book Lovers community has no Permission "Preferences", it follows that "Lotti Stein" too has no "Preferences" Permission.

As an administrator, you may need to set up the Community Users having Permissions, Preference as well as View, on the Mail portlet. Thus, the Community User can set up mail settings. That is, you need to add Permissions (Preference) on the Mail portlet at the Book Lovers community. Let's do it as follows (see the following figure):

  1. Click on the Configuration icon to the top right of the Mail portlet.
  2. Then click on the Permissions tab.
  3. Select the Community tab.
  4. Select Permission, Preferences, in the Available box.
  5. Click on the Add arrow, and
  6. Click on the Save button if you are ready.

Liferay Portal Enterprise Intranets

Using Mail Portlet effectively

Liferay Portal can integrate with Washington IMAP + Sendmail, Cyrus IMAP + Postfix, and Dovecot + Postfix, as well as with Microsoft Exchange and other IMAP servers. As stated above, the mail server "exg3.exghost.com" is Microsoft Exchange server.

You can access your email through an IMAP server. If access is on IMAP, the portal does not have to know where to persist the mail.

IMAP stands for Internet Message Access Protocol. URL: http://www.imap.org/.

One of the popular protocols used for email is IMAP, an application layer Internet protocol. IMAP operates on port 143 that allows a local client to access email on a remote server.

IMAP supports both connected and disconnected modes of operation. Until the User explicitly deletes them, email IMAP clients generally leave messages on the server. Moreover, IMAP offers access to the mail store.

IMAP has a lot of advantages. Here, we have listed just some of them:

  • Use connected and disconnected modes of operation.
  • Users can connect to the same mailbox simultaneously.
  • Users have access to MIME message parts and partial fetch.
  • Has message state information.
  • Supports multiple mailboxes on the server.
  • Provides ability for search on the server-side.
  • Has a built-in extension mechanism.

Working with SMS Text Messenger

In order to let employees send text message to others, anytime, we can use the Liferay SMS Text Messenger portlet. As an administrator of "Palm Tree Publications", you need to create a Page called "SMS" under the Page "Community" at the Book Lovers Community and add the SMS Text Messenger portlet in the Page, "SMS".

Using SMS Text Messenger

First of all, login as "Palm Tree". Then, let's do the above action as follows:

  1. Add a Page called "SMS" under the Page "Community" at the Book Lovers Community Public Pages, if the Page is not already present.
  2. Add the SMS Text Messenger portlet in the Page, "SMS" of the Book Lovers Community where you want to set up SMS Text Messenger (if this portlet is not already present). You will see the SMS Text Messenger portlet as shown in the following figure:

Liferay Portal Enterprise Intranets

As an editor of the editorial department, "Lotti Stein" wants to send a Message, say "Users in Staging server", to a person, say "admin@cignex.com". Let's do it as follows:

  1. Login as "Lotti Stein".
  2. Go to the Page "SMS" under the Page "Community" at the Book Lovers community Public Page.
  3. Locate the SMS Text Messenger.
  4. Input value for To as "admin@cignex.com", Subject as "Users in Staging server" and a Message.
  5. Click the Send Text Message button.

The User "admin@cignex.com" will receive this email sooner or later, as we have described in the previous section.

Liferay Portal Enterprise Intranets

How to Set up SMTP?

In order to make SMS Text Messenger work well, we have to set up the mail server with SMTP protocol. Suppose that the Enterprise "Palm Tree Publications" has a mail server with a domain "smtp.gmail.com", an account "jonasxyuan/jonas1234", and a protocol, SMTP. As an administrator, you need to integrate this mail server with SMTP protocol in Liferay. Let's do it as follows:

  1. Find the file ROOT.xml in $TOMCAT_DIR/conf/Catalina/localhost.
  2. Find the mail configuration first.
  3. Then, configure it as follows:
<Resource
name="mail/MailSession"
auth="Container"
type="javax.mail.Session"
mail.imap.host="smtp.gmail.com"
mail.pop.host="smtp.gmail.com"
mail.store.protocol="imap"
mail.transport.protocol="smtp"
mail.smtp.host="smtp.gmail.com"
mail.smtp.port="465"
mail.smtp.auth="true"
mail.smtp.starttls.enable="true"
mail.smtp.user="jonasxyuan"
password="jonas123456"
mail.smtp.socketFactory.class="javax.net.ssl.SSLSocketFactory"
/>

In short, the SMS Text Messenger portlet allows you to send SMS text messages from your portal page anytime.

Using SMS Effectively

The Short Message Service (SMS), called text messaging, is used to send short messages to and from mobile phones. It provides a mechanism for the delivery of short text messages over mobile networks, in order to transmit messages to and from mobiles. The text message from the sender can be stored in a central short message center, which then forwards it to the recipient. If the recipient is not available, the short message is stored temporally and will be sent later. SMS provides return receipts. Thus, the sender gets a brief message notification if the short message is delivered to the recipient.

You may need to read the following part, if you are interested in the organization of network elements for supporting SMS. Otherwise, you can leave it for your future needs. The following figure shows a typical organization of network elements in a network supporting SMS (refer to more details at http://www.wirelessdevnet.com/channels/sms/features/sms.html).

Liferay Portal Enterprise Intranets

The SMC (Short Message Center) stores and forwards messages, to and from the message station. The SME (Short Message Entity) receives and sends short messages.

The SMS GWMS (SMS gateway MSC), a gateway MSC, can receive short messages. After receiving the short message from the message center, GMSC employs the SS7 (Signaling System #7) network to interrogate the current position of the mobile station from the HLR (home location register).

HLR, as a main database, holds information about the subscription profile of the mobile. It also maintains the routing information for the subscriber where the mobile is currently situated. The GMSC thus passes on the short message to the correct MSC.

MSC (Mobile Switching Center) switches connections between mobile stations.

A VLR (Visitor Location Register) communicates with each MSC and contains temporary information about the mobile. MSC switches the short message to the corresponding BSS (Base Station System), which transmits the short message to the mobile. The BSS is made up of transceivers, which send and receive information over the air interface, to and from the mobile station. The short message is passed over signaling channels, so that the recipient (for example, mobile) can receive this short piece of information, even if a data call or a voice call is going on.

Summary

In this article we discussed how to manage (check, delete, add, reply, forward, search) emails and also to set up the Mail portlet properly. Finally, we discussed how to manage the SMS Text Messenger portlet and send SMS text messages.

Liferay Portal Enterprise Intranets A practical guide to building a complete corporate intranet with Liferay
Published: April 2008
eBook Price: $35.99
Book Price: $59.99
See more
Select your format and quantity:

About the Author :


Jonas X. Yuan

Jonas X. Yuan is a Chief Architect of ForgeLife LLC and an expert on Liferay Portal, e-commerce, and Content Management Systems (CMS). As an open source community contributor, he has published five Liferay books from 2008 to 2012. He is also an expert on Liferay integration with Ad Server OpenX, different search engines, enterprise content including videos, audio, images, documents, and web contents, and other technologies, such as BPM Intalio and Business Intelligence Pentaho, LDAP, and SSO. He holds a Ph.D. in Computer Science from the University of Zurich, where he focused on Integrity Control in federated database systems.

He earned his M.S. and B.S. degrees from China, where he conducted research on expert systems for predicting landslides. Previously, he worked as a Project Manager and a Technical Architect in Web GIS (Geographic Information System).
He is experienced in Systems Development Lifecycle (SDLC) and has deep, hands-on skills in J2EE technologies. He developed a BPEL (Business Process Execution Language) engine called BPELPower from scratch at the NASA data center. As the chief architect, Dr. Yuan successfully led and launched several large-scale Liferay/Alfresco e-commerce projects for millions of users each month.

He has worked on the following books: Liferay Portal Enterprise Intranets, 2008; Liferay Portal 5.2 Systems Development, 2009; Liferay Portal 6 Enterprise Intranets, 2010; Liferay User Interface Development, 2010; Liferay Portal Systems Development, 2012.

Books From Packt

 

Drupal 6 Social Networking
Drupal 6 Social Networking

Alfresco Developer Guide
Alfresco Developer Guide

Learning Joomla! 1.5 Extension Development
Learning Joomla! 1.5 Extension Development

Joomla! Web Security
Joomla! Web Security

OpenCms 7 Development
OpenCms 7 Development

WordPress Plug-in Development (Beginner's Guide)
WordPress Plug-in Development (Beginner's Guide)

Apache OFBiz Development: The Beginner's Tutorial
Apache OFBiz Development: The Beginner's Tutorial

Drupal for Education and E-Learning
Drupal for Education and E-Learning

 

 

 

 

 

Your rating: None Average: 3 (2 votes)

Post new comment

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.
i
j
P
M
5
x
Enter the code without spaces and pay attention to upper/lower case.
Code Download and Errata
Packt Anytime, Anywhere
Register Books
Print Upgrades
eBook Downloads
Video Support
Contact Us
Awards Voting Nominations Previous Winners
Judges Open Source CMS Hall Of Fame CMS Most Promising Open Source Project Open Source E-Commerce Applications Open Source JavaScript Library Open Source Graphics Software
Resources
Open Source CMS Hall Of Fame CMS Most Promising Open Source Project Open Source E-Commerce Applications Open Source JavaScript Library Open Source Graphics Software