Thursday, May 19, 2016

How To PerformAa Meaningful SMTP Telnet Test To Troubleshoot Java Mailer For Sending Email Notifications

How To PerformAa Meaningful SMTP Telnet Test To Troubleshoot Java Mailer For Sending Email Notifications

Steps to perform a meaningful telnet test to investigate java mailer issues related to sending workflow email notifications to the SMTP server.

It is mandatory to have an SMTP server set up in order to send the workflow notification e-mail messages. This means that the notification mailer does not send the notification e-mails itself but completely relies on the SMTP server to achieve this task.

For this reason, it is important to be able to send an email using telnet on the SMTP server in the conditions that are used by the mailer.

Note: this test is useful in the following situations (the below list is not exhaustive):

- One is setting the workflow notification mailer up and wants to validate the outbound processing parameters.
- One is suspect of a connectivity issue between the java mailer node and the SMTP server node.
- One suspects that the SMTP server does not process emails.
- One notices that given notifications in WF_NOTIFICATIONS have MAIL_STATUS = FAILED, and that the notification preference of the notification recipient has been switched to DISABLED (this can be seen in $FND_TOP/sql/wfmlrdbg.sql output against the given notification id).
- One wants to validate a given email address.
...

More particularly this test will provide relevant output when the following strings are seen in mailer log:

- javax.mail.SendFailedException: 550 5.7.1 Unable to relay
- javax.mail.MessagingException
- Invalid Address
- Relay access denied
- Unable to relay
- Relaying denied
- Client does not have permission to submit mail to this server
- Validation failed for the following parameters -> {OUTBOUND_SERVER=Unable to make a network connection.}
- EXCEPTION:[SVC-GSM-WFMLRSVC-12848-10006 : oracle.apps.fnd.wf.mailer.SMTPOutboundProcessor.read]:Not sending notification {3939936}because the notification mail status is null OR not 'MAIL'
- Updating notification {3939936} status {FAILED} {WFMLRSND_FAILED_UNDELIVERABLE} {{SYSADMIN}}...

Solution:

It is very important to perform all the steps mentioned below; they will allow to perform the telnet SMTP test from the right node and to pass the correct values during the test.

1) Identify the concurrent tiers node where mailer runs

by running script below:

select target_node from fnd_concurrent_queues where concurrent_queue_name like 'WFMLRSVC%';

It will return for example:

TARGET_NODE                    
------------------------------
ebiz1                    

In this example ebiz1 is the node where java mailer runs.

2) Gather other parameters values necessary for the SMTP telnet test:

To perform the SMTP telnet test, in addition to mailer node, you will also need to know on which node is the SMTP server (this is mailer "outbound server" parameter), and what is the reply to address that is set up for the java mailer (this is mailer "reply to" parameter).

To get these values run the following:

SELECT b.component_name, c.parameter_name, a.parameter_value FROM fnd_svc_comp_param_vals a, fnd_svc_components b, fnd_svc_comp_params_b c WHERE b.component_id = a.component_id AND b.component_type = c.component_type AND c.parameter_id = a.parameter_id AND c.encrypted_flag = 'N' AND b.component_name like '%Mailer%' AND c.parameter_name in ('OUTBOUND_SERVER', 'REPLYTO')
ORDER BY c.parameter_name;

It will return for example:

COMPONENT_NAME                  PARAMETER_NAME                 PARAMETER_VALUE        
------------------------------- ------------------------------ -----------------------
Workflow Notification Mailer    OUTBOUND_SERVER                mitini1                          
Workflow Notification Mailer    REPLYTO                        jmailer1@dummy_domain.com

In this example the outbound server is on mitini1 node and the reply to address is set to jmailer1@dummy_domain.com.

3) Perform the SMTP telnet test as follows:

3.1) Log on to the node where mailer runs (to identify it, please refer to step 1)

This is mandatory. SMTP telnet test is only meaningful when it is performed from the concurrent tier where mailer runs.

In our example you should log to ebiz1 node.

3.2) From mailer node, issue the following commands one by one:

telnet [outbound server] 25
EHLO [mailer node]
MAIL FROM: [reply_to address]
RCPT TO: [my_test_email_address]
DATA
Subject: Test message

Test message body
.
quit

Notes:

a) Very important, the commands needs to be entered one by one
b) Replace [outbound server] by the value retrieved for OUTBOUND_SERVER in step 2.
c) Replace [mailer node] by the value retrieved in step 1.
d) Replace [reply_to address] by the value retrieved for REPLYTO in step 2.
e) Replace [my_test_email_address] by the email address that you need to test.
f) By default SMTP server runs on port 25. If another port is used you'll have to modify the port accordingly in the syntax below.
g) Enter a blank line after the email subject and after the text 'Test message body'.
h) The end of the message is signaled by a "." on a line by itself.
i) To exit the telnet session, type 'quit' and then hit 'enter'.

So the commands to enter in the context of our example are:

telnet mitini1 25  
EHLO ebiz1  
MAIL FROM: jmailer1@dummy_domain.com  
RCPT TO: robert.king@dummy_domain.com
DATA  
Subject: Test message  

Test message body  
.  
quit
(let's assume robert.king@dummy_domain.com is the given address you want to test)

3.3) Then verify the following:

a) Has an error message been thrown during the test?

To compare the output you get with the normal output received during telnet SMTP test, please refer to section 8a (Verify SMTP Server ) in Note 242941.1 How To Troubleshoot Java-based Workflow Notification Mailer In 11.5.9 and OWF.G.

b) Check the INBOX of the email address used for the test (my_test_email_address)

Is there an email here with Subject: Test message and with sender corresponding to reply_to_address email address?

In our example, you should check robert.king@dummy_domain.com  INBOX and research a message with subject "Test message" and that is from sender jmailer1@dummy_domain.com.

4) Test interpretation

If an error message has been thrown during the test, or if the test email has not been received, this means the SMTP telnet test is not successful. Because the java mailer uses the SMTP server to send notification emails, it is a prerequisite for a correct behavior of the java mailer that this test is successful.
If the test is not successful, depending on the message received, the problem has to be addressed by the SMTP Server administrator or the Network administrator.  Commonly, relaying needs to be enabled.  The Workflow Mailer service will need to be restarted to pick up any changes made.

5) In addition to telnet, once can run the $AFJVAPRG command

from the Concurrent Manager tier to test the Connection to the SMTP Server:

$AFJVAPRG -classpath $AF_CLASSPATH -Dprotocol=smtp -Ddbcfile=$FND_SECURE/<name>.dbc -Dserver=myoraclehost.us.oracle.com -Dconnect_timeout=120 -Ddebug=Y -Daccount=NoSmtpUser -Dpassword=NoSmtpPasswd -DdebugMailSession=Y oracle.apps.fnd.wf.mailer.Mailer


But please understand, the connection test is only to determine that if the Workflow Mailer can connect to the SMTP Server successfully. But if the problem is "Unable to Relay",
that will inhibit the SMTP to send messages to certain email addresses if they are outside your network unless the SMTP Email Administrator Enables Relaying.

Info on RELAYING can be found at the SMTP Server Vendor's site

6) Finishing tasks

a) Confirm that the SMTP server defined within the Workflow Notification mailer setup reflects the correct address.

b) Once the mail server tests are complete and successful, to re-send any failed notifications, please run the Resend Failed Notifications concurrent request.

Reference metalink Doc ID 753845.1

No comments:

Post a Comment