Unit testing the Email notification
I frequently encounter the question about Unit testing the Email notification & in support while debugging time is spent waiting for a mail to arrive. In CQ, Email notification happens during "Subscription to page events", "Subscription to forum events", "Perform a step in a workflow" Or "Any custom implementation". Also based on envirnoment you might use "local Mail server", "free smtp server" etc... When you move on to next assignment the envirnoment differs. In this article I am sharing one of the mail utility developed and you might find this helpful.
Contents
Introduction
Mail utility is a custom application developed using google SubEtha[1] java library which acts as
- Platform independent Simple SMTP server.
- A Client to unit test the email notification of the received messages.
- Both command and GUI Interface
Advantages
The Mail utility tool will help in following usecase scenario
- Acts as a free SMTP server program to lets you send & unit test messages directly from your local computer.
- Corporate firewall settings might block access to free SMTP accounts. Example:- gmail, etc...
- Avoid reconfiguring the SMTP server when SMTP provider changes the IPs and ports
- Avoid cleaning the Inbox has the email is not persisted after shutdown.
- Unit test the cq email notifications to users such as
- Subscription to page events
- Subscription to forum events
- Perform a step in a workflow
- Any custom implementation
Installation & Configuration
Installation
- Download "mailutility.zip" and unzip into any directory it contains "smtpserverclient.jar" and "mailreader.properties".
- Start Mail utility using one of the following methods:
- If using a GUI file-system explorer, double-click the "smtpserverclient.jar" file.
- If using the command line with gui use, java -jar smtpserverclient.jar
- If gui is not supported in platform use, java -jar smtpserverclient.jar nonui
Configuration
- By default the SMTP server has host name "localhost" & port number "2566". To use different value copy a valid "mailreader.properties" file into the same directory as the "smtpserverclient.jar" file and modify property file using text editor.
- CQ Configuration snapshot and more details at http://dev.day.com/docs/en/cq/current/administering/notification.html
Usage
GUI
Non UI
To store the email copy into a file Type in "dump <filename>" and hit enter key to get the email dump stored in a file.
To shutdown Type in "quit" and hit enter key
Download
- mailutility.zip Click Here
Reference
[1] http://code.google.com/p/subethasmtp




Can any one let me k now best approach for testing CQ5
Thanks
Kumar
<a href="http://defiestas.com.mx">Salon de Fiestas</a>
Contents