There are a number of different configuration settings you can tweak to help ensure e-mails are being sent out from WebSphere Commerce successfully and efficiently. This is not a troubleshooting walkthrough per se, but if you are encountering problems with sending e-mails, try going through the following steps to make sure you have the application configured correctly:
- Designate a single node in your cluster of which to send out e-mails from using the SendTransactedMsg scheduled job. Running this job from multiple nodes simultaneously may inadvertently cause concurrency problems at the database. See the following document for information on how to configure this:
Configuring the scheduler to run a job on an instance or cluster member
- When scheduling the SendTransactedMsg job in the Commerce Administration Console, set your interval to allow adequate time for the job to complete (the default is five minutes-- this is a safe choice in most cases, but may be shortened depending on your traffic). Currently, there is no mechanism within WebSphere Commerce to prevent a subsequent instance of the job from running in parallel, however this type of behavior can be achieved by implementing this customization.
UPDATE: In Fix Pack 8, a feature has been added to the scheduler to prevent multiple instances of the same job from running concurrently. To configure this, set the parameter maxThreads in the job parameters field (ex. maxThreads=1). Note that if this is configured and another job attempts to run concurrently, the second job will essentially be marked as "Failed" in the Scheduler.
- Along with the interval and maxThreads settings above, experiment with adjustments to the batchSize and numOfMessages parameters in the SendTransactedMsg job to get the highest possible throughput from each execution of the scheduled job. By default, batchSize is set to 1, meaning we will send each individual message in its own separate transaction. If numOfMessages is not set, it will try to send out all outstanding messages each run. During peak traffic, a large accumulation of messages might cause the job to spill over during the next scheduled instance's start time. Or, if the message processing cannot keep up with the incoming volume, the job might continue to run indefinitely, or until the Scheduler transaction timeout is reached. These are not ideal settings for a high performance environment.
When making adjustments for the first time, start with values like batchSize=20&numOfMessages=20. After the job runs and processes all 20 messages, record how much time it took for the job to complete. Using this as a baseline, increase the batchSize and numOfMessages parameters until you are able to process the maximum number of messages within the scheduled job's defined interval (ex. 400 messages in 180 seconds). You will want to allow for a small gap of 'idle' time between the completion of the job and the execution of the subsequent one to account for scenarios where network conditions might not be ideal.
- If you are running WebSphere Commerce 126.96.36.199 or higher, ensure you have configured the connection pool settings for the JCAEmailConnector to match that of your SMTP server. If you are encountering runtime errors where the connector is unable to acquire a connection to the SMTP server, you most likely need to adjust these. See the following document:
SMTP Email connections behave differently between V7.0 and V6.0
- If you see SMTP timeout errors, your firewall may be blocking No Operation (NOOP) messages. You can configure WebSphere Commerce to use RSET messages instead which may mitigate this problem. See the following documents:
Switch from NOOP to RSET to avoid SMTP communication hanging
Configuring validation for No Operation (NOOP) messages
- If you are sending HTML e-mails but they are showing up as plaintext, ensure you have the Content-Type setting for the message type set to 'text/html' (without the quotes) in the WebSphere Commerce Administration Console.
Remember: Message types can be configured at both the Site and Store levels. The Store level settings will take precedence.
Configuring outbound email notification messages
- For character encoding issues, be sure to go through the settings mentioned in the technote here:
Troubleshooting special character encoding issues in WebSphere Commerce
- For additional SMTP settings (timeout, etc). try adjusting the JavaMail parameters in the <WAS_installdir>/lib/JCAEmailConnectionRequestInfo.properties. file. See the following document for more information:
Adding JavaMail parameters to the WebSphere Commerce Environment
- If you're stuck troubleshooting an e-mail connection problem, you can enable Javamail tracing by setting the mail.debug=true property in the aforementioned JCAEmailConnectionRequestInfo.properties file. This tracing will show you the SMTP commands being issued to the server. Output is written to the SystemOut.