Test IQ Server mail settings using iq-mail-tester.jar

Note: This article is primarily for IQ Server release 82 and earlier. Starting in IQ Server 83 mail server settings have moved into the UI and those settings inside your config.yml are not used. A mail server Test button will be available in a future release. 

What is iq-mail-tester?

The iq-mail-tester.jar is a command-line utility that will allow you to test and verify your IQ Server 82 and earlier mail settings.

The utility will read the mail settings from the IQ Server's config.yml file and attempt to send an email to a specified recipient. The utility runs in debug mode and in case of any failure will output the cause allowing you to diagnose the reason and make any corrections to your mail settings and/or mail server.

Download iq-mail-tester.jar

Requirements

Iq-mail-tester requires Java 8 or greater. Typically you want to ensure that the exact same Java runtime used to run IQ Server is also used to execute the iq-mail-tester.jar.

It must be run on the same server where IQ Server is running and must have read access to your IQ Server's config.yml file.

You must also enable and configure the mail section of the config.yml as described in the IQ Server documentation Email Notification Configuration before running the utility.

How to use it

The jar is a self-contained executable that expects two inputs:

  1. Full path to config.yml
  2. Recipient's email address

For expected usage simply launch it without arguments:

> java -jar iq-mail-tester.jar
Expected usage: iqmailtester.jar <full_path_to_iq_config.yml> <recipient_email_address>

Sample Output

Successful test:

An example successful test will return a SMTP 250 OK response from your mail server:

> java -jar iq-mail-tester.jar /IQ/nexus-iq-server-1.63.0-01-bundle/config.yml joebloggs@localhost
...
250 2.0.0 OK 1557396942 h123sm1469262wme.6 - smtp
DEBUG SMTP: message successfully delivered to mail server

Failed test:

A failed test will log the full exception. For example, the following is output from a failed test where the utility could not connect to the mail server e.g. due to incorrect host/port or connection blocked due to firewall/network:

> java -jar iq-mail-tester.jar /IQ/nexus-iq-server-1.63.0-01-bundle/config.yml joebloggs@localhost
...
DEBUG SMTP: trying to connect to host "smtp.your.mailserver.com", port 25
Exception in thread "main" org.simplejavamail.mailer.internal.mailsender.MailSenderException: Third party error
at org.simplejavamail.mailer.internal.mailsender.MailSender.sendMailClosure(MailSender.java:283)
at org.simplejavamail.mailer.internal.mailsender.MailSender.send(MailSender.java:211)
at org.simplejavamail.mailer.Mailer.sendMail(Mailer.java:239)
at org.simplejavamail.mailer.Mailer.sendMail(Mailer.java:230)
at org.sonatype.support.IQEmailTester.main(IQEmailTester.java:81)
Caused by: com.sun.mail.util.MailConnectException: Couldn't connect to host, port: smtp.your.mailserver.com, 25; timeout -1;
nested exception is:
java.net.ConnectException: Operation timed out (Connection timed out)
at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:2194)
at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:726)
at javax.mail.Service.connect(Service.java:388)
at javax.mail.Service.connect(Service.java:246)
at javax.mail.Service.connect(Service.java:195)
at org.simplejavamail.mailer.internal.mailsender.MailSender.sendMailClosure(MailSender.java:265)
... 4 more
Caused by: java.net.ConnectException: Operation timed out (Connection timed out)
at java.net.PlainSocketImpl.socketConnect(Native Method)
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.SocksSocketImpl.connect(SocksSocketImpl.java:392)
at java.net.Socket.connect(Socket.java:589)
at java.net.Socket.connect(Socket.java:538)
at com.sun.mail.util.SocketFetcher.createSocket(SocketFetcher.java:352)
at com.sun.mail.util.SocketFetcher.getSocket(SocketFetcher.java:238)
at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:2160)
... 9 more

 

 

Have more questions? Submit a request

0 Comments

Article is closed for comments.