Overview
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.
1. Configure Mailer Outbound/Inbound with GMail servers
Mailer Outbound and Inbound can be configured with GMail SMTP and IMAP servers using below configuration details.
SMTP server
| Host Name | smtp.gmail.com |
| SSL Port | 465 |
| TLS/SSL required | Yes |
| User Name | Your full email address (including @gmail.com or @your_domain.com) |
| Password | Your gmail password |
IMAP server
| Host Name |
imap.gmail.com |
| SSL Port |
993 |
| TLS/SSL Required |
Yes |
| User Name |
Your full email address (including @gmail.com or @your_domain.com) |
| Password | Your gmail password |
2. Install GMail server SSL Certificates
The following is the procedure to install the GMail SSL certificates
- Download the GMail SMTP and IMAP server SSL certificates
- Install the SMTP server 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_smtp-lnx_chainnedcert -file gmail_smtp.cer - Install into a custom location
# keytool -import -trustcacerts -keystore <customLocation> -storepass changeit
<customLocation> — directory in instance where the certificate need to be installed
-alias gmail_smtp-lnx_chainnedcert -file gmail_smtp.cer
- Install the IMAP server 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_imap-lnx_chainnedcert -file gmail_imap.cer - Install into a custom location
# keytool -import -trustcacerts -keystore <customLocation> -storepass changeit
<customLocation> — directory in instance where the certificate need to be installed
-alias gmail_imap-lnx_chainnedcert -file gmail_imap.cer
- After installing the certificates using the above commands you can see the following response, type ‘yes’ to complete.
Trust this certificate? [no]: yes
Certificate was added to keystore
3. GMail Account security setup
The following security configuration needs to performed for the GMail accounts that are used for Mailer Outbound and Inbound configuration.
- Turn on less secure access using below URL by logging into account from browser
https://www.google.com/settings/security/lesssecureapps
- Create PROCESSED and DISCARD folders in your GMail account if the Mailer is not able to create automatically
- You will get an email with subject like ‘New Sign-in from’ or ‘Some
unknown device or password’ when Mailer trying to access your gMail
account. You need to allow access for these from by logging into
account.
4. Run Mailer Command Line Diagnostics
- 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
-Dserver=smtp.gmail.com -Dport=465 -Dssl=Y
-Dtruststore=$AF_JRE_TOP/lib/security/cacerts -Daccount=<gmailUsername>
-Dpassword=<password> -Dconnect_timeout=120 -Ddebug=Y -Dlogfile=GmailSmtpTest.log
-DdebugMailSession=Y oracle.apps.fnd.wf.mailer.Mailer - 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
-Dserver=imap.gmail.com -Dport=993 -Dssl=Y
-Dtruststore=$AF_JRE_TOP/lib/security/cacerts -Daccount=<gmailUsername>
-Dpassword=<password> -Dconnect_timeout=120 -Ddebug=Y -Dlogfile=GmailImapTest.log
-DdebugMailSession=Y oracle.apps.fnd.wf.mailer.Mailer
5. Troubleshooting Steps
Standalone program to verify the SMTP connection
If the Mailer fails to connect to GMail SMTP server after performing the above given configuration, 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 message to the given recipient
user email address.
Sample program to test GMail SMTP connection
The standalone program can be run as below
$java GmailSMTPTest GMailUsername GMailPassword recipientEmailAddress
Standalone program to verify the IMAP connection
If the Mailer fails to connect to GMail IMAP server after performing the above given configuration, 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
Warnings
- As gmail.com 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