SEND_MAIL return code 2000142 with no further information
search cancel

SEND_MAIL return code 2000142 with no further information

book

Article ID: 279173

calendar_today

Updated On:

Products

CA Automic Workload Automation - Automation Engine CA Automic One Automation Automic SaaS

Issue/Introduction

When running a SEND_MAIL script function in 21.0 with the following script:

:  SET &EMAIL# = SEND_MAIL("[email protected]",,"Subject line here",&NOTIFICATION_TEXT#)
:  P &EMAIL#

The return code was simply:

0000000002000142

or 2000142

What is causing the problem?  This return code is not in the documentation.

Environment

Version: 21.0

Cause

Undocumented return code - further investigation shown below

Resolution

This return code is stating that there is a problem with the SEND_MAIL command.  Further investigation is required as described in two possible ways below:

  1. Look into the JWP logs for a line like the following:

    U02000142 Unrecoverable I/O error found by Module/Function 'sendMail'. Error:

    Directly before this after it will be a further explanation of the error.  For example:

    U00045014 Exception 'java.net.ConnectException: "Connection timed out (Connection timed out)"' at 'java.net.PlainSocketImpl.socketConnect()'.
    U02000142 Unrecoverable I/O error found by Module/Function 'sendMail'. Error: 'java.net.ConnectException:Connection timed out (Connection timed out)'.

    which is showing that there is a problem with a timeout when communicating with the SMTP server.

  2. Another option is to use further scripting like this in the process tab:

    :set &ret# = send_mail('[email protected]', , 'Subject line is here', 'Email Body text is here')
    :p &ret#
    :set &errins# = sys_last_err_ins()
    :if &errins# ne ""
    :  set &errnr# = sys_last_err_nr()
    :  set &message# = get_msg_txt(&errnr#, &errins#)
    :  send_msg username, dept, &message#
    :  p 'Error is &message#'
    :endif

    This will result in a message sent to username/dept in the messages window and a report that shows:

    U00020408 0000000002000142
    U00020408 U02000142 Unrecoverable I/O error found by Module/Function 'sendMail'. Error: 'java.net.UnknownHostException:nonexistant.smtp.server.example.com'.

 

Additional Information

For more information, please see the SEND_MAIL documentation page.