Wow, here goes, a post about WCM!
We often need to set up simple email system to test WCM’s email action. This feature is used in workflow. The system can be configured to email a user when they need to approve content to move to the next workflow stage, for example.
I like to set up a local smtp/pop3 server on the same machine that Portal is running on, then we don’t have to worry about DNS or MX records or anything nasty like that and can focus on the WCM features. This could be useful for you if you need to run a demo or something all on the same machine.
I did these steps on a Redhat 5 machine. My server’s fully qualified hostname is narrabeen.ilwwcm.au.ibm.com , for those following along at home.
First install postfix and dovecot . They are simple and secure and do just what we want. If you are familiar with another MTA, like sendmail, just use that instead.
or for the non yum users out there
Note that you should remove sendmail after you install postfix otherwise rpm will complain about dependency issues.
Dovecot works completely out of the box, just run :
And test it from your machine by trying to telnet to port 110 on the server.
Cool, lets make some local users that we can send mail to.
useradd adminuser ; passwd adminuser
This creates local mailboxes on the server that we will address later as : <user>@<fullyqualifieddomainname> . In my case these addresses are firstname.lastname@example.org and email@example.com . Please note that WCM will not forward to user@localhost type addresses, so you will need to address your mail to a ‘proper’ domain.
Now the WCM part. Open your WCMConfigService.properties file. I am using 126.96.36.199 at the moment, but this is valid for any version of WCM. The config file named differently in 5.1 (connect.cfg), and located somewhere else (under Portal Home instead of in the profile) in 6.0, but the properties are quite similar. On 6.1 this is located in [PROFILE_PATH]/PortalServer/wcm/shared/app/config/wcmservices/WCMConfigService.properties
We are concerned with this paragraph:
Change mail.yourserver.com to your mail server
Now we need to link users in Portal to the email addresses we have created. Load up Portal, log in as your admin user and go to Administration -> Users and Groups .
Create a new user and enter the email address.
Edit your admin user too, and assign it the email address admin@localhost, which you created earlier.
Create a new library and assign the user manager access to the library. Go to the authoring portlet, click configure and select the library you just created. Logout and log in as the new user.
Now you’ll have to create all the basic stuff before you can create content. Start with the email action and enable all the options, so it will send an email to every account involved in the process. Now add the email action to the ‘entry’ section of the first workflow stage and add the workflow stage to a workflow. Create a presentation template, authoring template, site, site area and finally a piece of content. It should be in the draft stage now. Since the email action is in the entry section, it will be fired every time we create new content, which is good for testing the email action.
Configure up your POP3 client of choice and point it to your Portal/email server using the admin username and password (since the admin user will need to approve the content). I am using the excellent Thunderbird for this purpose. If everything has gone well, we should see an email sitting in Thunderbird.
As you can see, the email that appears is from firstname.lastname@example.org , which is the value I used for “defaultfromaddress” in the WCMConfigService.properties file.
What if it doesn’t work ? Email is like a series of tubes (with apologies to Ted Stevens) . You need to check that the email is being generated by WCM, and then if WCM is sending it to the right place, and *then* if postfix is sending it to dovecot. SystemOut doesn’t log emails that are sent out so it can be difficult to debug. This trace string is your friend if you’re not sure where to start. It should log WCM’s attempt to send the mail to postfix.
To use the trace string, go to Administration -> Portal Analysis -> Enable Tracing and copy the trace string into the box. A trace.log file should appear in [PROFILE_ROOT]/logs/WebSphere_Portal/
If WCM is sending the email properly, you will see something like this in the trace.log :
[4/20/09 12:14:13:302 EST] 000001fa MailConnectio 3 MailConnector: Getting new SMTP transport
[4/20/09 12:14:13:680 EST] 000001fa MailConnectio 3 MailConnector: Mail Sent!
If the mail is still not turning up in the mailbox, we need to turn our attention to /var/log/maillog . By default both dovecot and postfix will log to this file.
Apr 20 10:47:11 narrabeen postfix/smtpd: 1DB7D798040: client=narrabeen.ilwwcm.au.ibm.com[127.0.0.1]
Apr 20 10:47:11 narrabeen postfix/cleanup: 1DB7D798040: message-id=<1803316092.1240188430966.JavaMail.root@narrabeen>
Apr 20 10:47:11 narrabeen postfix/qmgr: 1DB7D798040: from=, size=1146, nrcpt=1 (queue active)
Apr 20 10:47:11 narrabeen postfix/smtpd: disconnect from narrabeen.ilwwcm.au.ibm.com[127.0.0.1]
Apr 20 10:47:11 narrabeen postfix/smtp: 1DB7D798040: to=, relay=none, delay=0.19, delays=0.08/0.11/0/0, dsn=5.4.6, status=bounced (mail for narrabeen.ilwwcm.au.ibm.com loops back to myself)
I had this problem when trying to set this up. Postfix does a number of checks to figure out whether to relay the mail to another mail server, or to keep it on the local server and route it to a local user. We want it to do the latter.
We need to change the value mydestination so it matches the mail server address we are using (everything to the right of the @ symbol in the email address) . Additionally we should change mynetworks_style from subnet (the default) to host, as we don’t want postfix to accept mail from any other host in our subnet or not.
If your postfix server is on a different machine to portal, you’d obviously skip this step.
mynetworks_style = host
To make these changes take effect run:
Now create a new piece of content. Tailing /var/log/maillog helps to make sure the mail is correctly hitting postfix.
Apr 20 12:14:13 narrabeen postfix/smtpd: 9B60D798040: client=narrabeen.ilwwcm.au.ibm.com[127.0.0.1]
Apr 20 12:14:13 narrabeen postfix/cleanup: 9B60D798040: message-id=<1790995136.1240193653304.JavaMail.root@narrabeen>
Apr 20 12:14:13 narrabeen postfix/qmgr: 9B60D798040: from=, size=1142, nrcpt=2 (queue active)
Apr 20 12:14:13 narrabeen postfix/local: 9B60D798040: to=, relay=local, delay=0.17, delays=0.05/0.09/0/0.04, dsn=2.0.0, status=sent (delivered to mailbox)
Another useful command to use when debugging postfix is postconf -n , which will print all the parameters that are currently in effect for the server.
Well, hope that made some sense, send me a message and let me know how you went.