Thursday, August 7, 2014

Using GMail's SMTP and IMAP servers in Oracle Notification Mailer (Workflow Mailer )

Hi All ...
Here the step by step guide how to use Gmail account  with Oracle Workflow mailer.
Tested it in couple of customer sites and it working perfect...

GMail offers free, reliable, popular SMTP and IMAP services, because of which many people are interested to use it. GMail can be used when there are no in-house SMTP/IMAP servers for testing or debugging purposes. This blog explains how to install GMail SSL certificate in Concurrent Tier, testing the connection using a standalone program, running Mailer diagnostics and configuring GMail IMAP and SMTP servers for Workflow Notification Mailer Inbound and Outbound connections.

GMail servers configuration

SMTP server 

Host Name
SSL Port 465
TLS/SSL required Yes
User Name Your full email address (including or
Password Your gmail password

 IMAP server

 SSL Port993 
TLS/SSL Required Yes 
 User Name Your full email address (including or
 PasswordYour gmail password

GMail SSL Certificate Installation

The following is the procedure to install the GMail SSL certificate
  • Copy the below GMail SSL certificate in to a file eg: gmail.cer
    -----END CERTIFICATE-----
    • Install the SSL certificate into the default JRE location or any other location using below command
    • Installing into a dfeault JRE location in EBS instance
            # keytool -import -trustcacerts -keystore $AF_JRE_TOP/lib/security/cacerts  -storepass changeit -alias gmail-lnx_chainnedcert -file gmail.cer
    • Install into a custom location
            # keytool -import -trustcacerts -keystore <customLocation>  -storepass changeit -alias gmail-lnx_chainnedcert -file gmail.cer
           <customLocation> -- directory in instance where the certificate need to be installed
    • After running the above command you can see the following response
            Trust this certificate? [no]:  yes
            Certificate was added to keystore 

    Running Mailer Command Line Diagnostics

    • Run Mailer command line diagnostics from conccurrent tier where Mailer is running, to check the IMAP connection using the below command
    $AFJVAPRG -classpath $AF_CLASSPATH -Dprotocol=imap -Ddbcfile=$FND_SECURE/$TWO_TASK.dbc -Dport=993 -Dssl=Y -Dtruststore=$AF_JRE_TOP/lib/security/cacerts -Daccount=<gmail username> -Dpassword=<password> -Dconnect_timeout=120 -Ddebug=Y -Dlogfile=GmailImapTest.log -DdebugMailSession=Y
    • Run Mailer command line diagnostics from concurrent tier where Mailer is running, to check the SMTP connection using the below command  
     $AFJVAPRG -classpath $AF_CLASSPATH -Dprotocol=smtp -Ddbcfile=$FND_SECURE/$TWO_TASK.dbc -Dport=465 -Dssl=Y -Dtruststore=$AF_JRE_TOP/lib/security/cacerts -Daccount=<gmail username> -Dpassword=<password> -Dconnect_timeout=120 -Ddebug=Y -Dlogfile=GmailSmtpTest.log -DdebugMailSession=Y 

    Standalone program to verify the IMAP connection

    Run the below standalone program from the concurrent tier node where Mailer is running to verify the connection with GMail IMAP server. It connects to the GMail IMAP server with the given GMail user name and password and lists all the folders that exist in that account. If the GMail IMAP server is not working for the  Mailer check whether the PROCESSED and DISCARD folders exist for the GMail account, if not create manually by logging into GMail account.
    Sample program to test GMail IMAP connection
     The standalone program can be run as below
     $java GmailIMAPTest GMailUsername GMailUserPassword           

    Standalone program to verify the SMTP connection

    Run the below standalone program from the concurrent tier node where Mailer is running to verify the connection with GMail SMTP server. It connects to the GMail SMTP server by authenticating with the given user name and password  and sends a test email message to the give recipient user email address.
    Sample program to test GMail SMTP connection
    The standalone program can be run as below 
     $java GmailSMTPTest GMailUsername GMailPassword recipientEmailAddress   


    • As is an external domain, the Mailer concurrent tier should allow the connection with GMail server
    • Please keep in mind when using it for corporate facilities, that the e-mail data would be stored outside the corporate network
    Good Luck ...

    No comments:

    Post a Comment