Unable to connect to Email settings Gmail/outlook

Hi there,

I am trying to setup an email(Gmail/outlook) for my Katalon studio(Project -> Settings -> Email). I have tried all the possible ways given in the forum.
Issue#1: Gmail Setup
Below are the steps followed

  1. Below set up is done under Project -> Settings -> Email
  2. Certificates added to Keystore by following the steps given
  3. Since I am on Company machine I cannot disable the Antivirus
  4. Also pinged the smtp server to check Gmail server. Getting the correct response
  5. Now when I click on Send test email getting below error
    image

Please find the below logs
!ENTRY org.eclipse.e4.ui.workbench 4 0 2020-09-11 17:46:01.525
!MESSAGE
!STACK 0
org.apache.commons.mail.EmailException: Sending the email to the following server failed : smtp.gmail.com:465
at org.apache.commons.mail.Email.sendMimeMessage(Email.java:1421)
at org.apache.commons.mail.Email.send(Email.java:1448)
at com.kms.katalon.execution.util.MailUtil.sendTestMail(MailUtil.java:81)
at com.kms.katalon.composer.execution.settings.MailSettingsPage$16.run(MailSettingsPage.java:554)
at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:119)
Caused by: javax.mail.MessagingException: Could not connect to SMTP host: smtp.gmail.com, port: 465, response: -1
at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1270)
at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:370)
at javax.mail.Service.connect(Service.java:297)
at javax.mail.Service.connect(Service.java:156)
at javax.mail.Service.connect(Service.java:105)
at javax.mail.Transport.send0(Transport.java:168)
at javax.mail.Transport.send(Transport.java:98)
at org.apache.commons.mail.Email.sendMimeMessage(Email.java:1411)
… 4 more

Is it only because of antivirus not being disabled? Cant we proceed without disabling it?

Issue#2: Outlook Setup
For outlook I am not able to download the certificates in keystore. Getting following error


what is the issue here? Are there any other setting I need to perform for setting up outlook?

could you please respond ASAP?

Any update on above query?

@Sdhongadi

For Gmail, you should enable less secure account first: https://support.google.com/accounts/answer/6010255

Port: 465 -> Protocol: SSL
Port: 587 -> Protocol: TLS

@duyluong
Thank you very much! It worked. I am able to send and receive Emails on Gmail

Also could you please help me with setting up Microsoft365 outlook? As mentioned earlier I am not able to install Java certification for smtp.outlook365.com.


image
Error log:
!STACK 0
org.apache.commons.mail.EmailException: Sending the email to the following server failed : smtp.outlook365.com:587
at org.apache.commons.mail.Email.sendMimeMessage(Email.java:1421)
at org.apache.commons.mail.Email.send(Email.java:1448)
at com.kms.katalon.execution.util.MailUtil.sendTestMail(MailUtil.java:81)
at com.kms.katalon.composer.execution.settings.MailSettingsPage$16.run(MailSettingsPage.java:554)
at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:119)
Caused by: javax.mail.MessagingException: Could not connect to SMTP host: smtp.outlook365.com, port: 587;
nested exception is:
java.net.ConnectException: Connection timed out: connect
at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1282)
at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:370)
at javax.mail.Service.connect(Service.java:297)
at javax.mail.Service.connect(Service.java:156)
at javax.mail.Service.connect(Service.java:105)
at javax.mail.Transport.send0(Transport.java:168)
at javax.mail.Transport.send(Transport.java:98)
at org.apache.commons.mail.Email.sendMimeMessage(Email.java:1411)
… 4 more
Caused by: java.net.ConnectException: Connection timed out: connect
at java.net.DualStackPlainSocketImpl.waitForConnect(Native Method)
at java.net.DualStackPlainSocketImpl.socketConnect(DualStackPlainSocketImpl.java:85)
at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:172)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
at java.net.Socket.connect(Socket.java:589)
at sun.security.ssl.SSLSocketImpl.connect(SSLSocketImpl.java:673)
at com.sun.mail.util.SocketFetcher.createSocket(SocketFetcher.java:230)
at com.sun.mail.util.SocketFetcher.getSocket(SocketFetcher.java:163)
at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1250)
… 11 more

Hi @Sdhongadi,

Please share your email settings using Outlook SMTP.

@duyluong
Sure! Please find below screenprint.

Hi @Sdhongadi,

Please change the protocol to TLS and try again.

@duyluong
Tried the above setting still getting the error.
However I am sure that the credentials I have provided are correct. I am able to login into web outlook365 using this credentials but it asks the authentication via text msg or phone. Is that causing the issue?

image
!STACK 0

org.apache.commons.mail.EmailException: Sending the email to the following server failed : smtp.office365.com:587
at org.apache.commons.mail.Email.sendMimeMessage(Email.java:1421)
at org.apache.commons.mail.Email.send(Email.java:1448)
at com.kms.katalon.execution.util.MailUtil.sendTestMail(MailUtil.java:81)
at com.kms.katalon.composer.execution.settings.MailSettingsPage$16.run(MailSettingsPage.java:554)
at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:119)
Caused by: javax.mail.AuthenticationFailedException
at javax.mail.Service.connect(Service.java:306)
at javax.mail.Service.connect(Service.java:156)
at javax.mail.Service.connect(Service.java:105)
at javax.mail.Transport.send0(Transport.java:168)
at javax.mail.Transport.send(Transport.java:98)
at org.apache.commons.mail.Email.sendMimeMessage(Email.java:1411)
… 4 more

!ENTRY org.eclipse.e4.ui.workbench 4 0 2020-09-14 15:11:36.380
!MESSAGE
!STACK 0
org.apache.commons.mail.EmailException: Sending the email to the following server failed : smtp.office365.com:587
at org.apache.commons.mail.Email.sendMimeMessage(Email.java:1421)
at org.apache.commons.mail.Email.send(Email.java:1448)
at com.kms.katalon.execution.util.MailUtil.sendTestMail(MailUtil.java:81)
at com.kms.katalon.composer.execution.settings.MailSettingsPage$16.run(MailSettingsPage.java:554)
at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:119)
Caused by: javax.mail.AuthenticationFailedException
at javax.mail.Service.connect(Service.java:306)
at javax.mail.Service.connect(Service.java:156)
at javax.mail.Service.connect(Service.java:105)
at javax.mail.Transport.send0(Transport.java:168)
at javax.mail.Transport.send(Transport.java:98)
at org.apache.commons.mail.Email.sendMimeMessage(Email.java:1411)
… 4 more

@Sdhongadi

However I am sure that the credentials I have provided are correct. I am able to login into web outlook365 using this credentials but it asks the authentication via text msg or phone. Is that causing the issue?

You should turn-off 2 steps verification and try again or use another account with disabling 2 steps verification.

@duyluong
I tried to delete all the authentication methods present under Settings -> Security Info in outlook365. There is no option to disable it and when I deleted all the options and tried to login again into Web outlook it does not allow me to Sign-in without creating the authentication method.
This is probably due to security reason of our Organization, can I not use this emailing facility of Katalon Studio without disabling the two factor authentication in outlook365?

Also find the logs when I deleted the authentication method and tried to run in Katalon
org.apache.commons.mail.EmailException: Sending the email to the following server failed : smtp.office365.com:587
at org.apache.commons.mail.Email.sendMimeMessage(Email.java:1421)
at org.apache.commons.mail.Email.send(Email.java:1448)
at com.kms.katalon.execution.util.MailUtil.sendTestMail(MailUtil.java:81)
at com.kms.katalon.composer.execution.settings.MailSettingsPage$16.run(MailSettingsPage.java:554)
at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:119)
Caused by: javax.mail.AuthenticationFailedException
at javax.mail.Service.connect(Service.java:306)
at javax.mail.Service.connect(Service.java:156)
at javax.mail.Service.connect(Service.java:105)
at javax.mail.Transport.send0(Transport.java:168)
at javax.mail.Transport.send(Transport.java:98)
at org.apache.commons.mail.Email.sendMimeMessage(Email.java:1411)
… 4 more

!ENTRY org.eclipse.e4.ui.workbench 4 0 2020-09-14 16:41:09.775
!MESSAGE
!STACK 0
org.apache.commons.mail.EmailException: Sending the email to the following server failed : smtp.office365.com:587
at org.apache.commons.mail.Email.sendMimeMessage(Email.java:1421)
at org.apache.commons.mail.Email.send(Email.java:1448)
at com.kms.katalon.execution.util.MailUtil.sendTestMail(MailUtil.java:81)
at com.kms.katalon.composer.execution.settings.MailSettingsPage$16.run(MailSettingsPage.java:554)
at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:119)
Caused by: javax.mail.AuthenticationFailedException
at javax.mail.Service.connect(Service.java:306)
at javax.mail.Service.connect(Service.java:156)
at javax.mail.Service.connect(Service.java:105)
at javax.mail.Transport.send0(Transport.java:168)
at javax.mail.Transport.send(Transport.java:98)
at org.apache.commons.mail.Email.sendMimeMessage(Email.java:1411)
… 4 more

@duyluong Any update on above query?

If you’re having trouble connecting your Gmail account to Outlook or Mail for Windows 10, this might be due to your Gmail settings.

Step 1: Enable IMAP
In a browser, go to Gmail.com.
Select. > Settings.
Select the Forwarding and POP/IMAP tab.
Under IMAP Access, select Enable IMAP.
Select Save Changes.

@Lewis-H @duyluong
I checked the settings in Gmail it is already enabled, however I am unable to send an email from my outlook365 id(Gmail to and from is working fine)
Getting below error due to two factor authentication for outlook365 in our organization
And due to security reasons we cannot skip this step

org.apache.commons.mail.EmailException: Sending the email to the following server failed : smtp.office365.com:587
at org.apache.commons.mail.Email.sendMimeMessage(Email.java:1421)
at org.apache.commons.mail.Email.send(Email.java:1448)
at com.kms.katalon.execution.util.MailUtil.sendTestMail(MailUtil.java:81)
at com.kms.katalon.composer.execution.settings.MailSettingsPage$16.run(MailSettingsPage.java:554)
at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:119)
Caused by: javax.mail.AuthenticationFailedException
at javax.mail.Service.connect(Service.java:306)
at javax.mail.Service.connect(Service.java:156)
at javax.mail.Service.connect(Service.java:105)
at javax.mail.Transport.send0(Transport.java:168)
at javax.mail.Transport.send(Transport.java:98)
at org.apache.commons.mail.Email.sendMimeMessage(Email.java:1411)
… 4 more