Failed to convert to JAVA MAIL - Syntax Error
search cancel

Failed to convert to JAVA MAIL - Syntax Error

book

Article ID: 140000

calendar_today

Updated On:

Products

CA Service Desk Manager

Issue/Introduction

Mail notifications are not being sent for tickets for some users/tickets.

NX_ROOT/log/mail_nxd log has several errors like below, 

 2019-11-06 11:45:07:629 INFO   [Thread-4] c.c.S.m.MessageProcessorActorSystem - Found (1) messages in mail queue directory

 2019-11-06 11:45:07:660 ERROR  [mailNxdActorSystem-akka.actor.default-dispatcher-3] c.c.S.m.NXMessageToTargetMessageConverter - Failed to convert to JAVA MAIL
 javax.mail.internet.AddressException: Missing '<'
  at javax.mail.internet.InternetAddress.parse(InternetAddress.java:857)
  at javax.mail.internet.InternetAddress.parse(InternetAddress.java:655)
  at javax.mail.internet.InternetAddress.<init>(InternetAddress.java:115)
  at com.ca.ServicePlus.mailer.JavaMailSession.getAddresses(JavaMailSession.java:306)

 ..

 ..

 2019-11-06 11:45:07:691 ERROR 16:45:07.691UTC [mailNxdActorSystem-akka.actor.default-dispatcher-6] c.c.S.m.NXMailMailerActor - Unable to send the mail. Reason: java.lang.NullPointerException
 2019-11-06 11:45:07:691 ERROR 16:45:07.691UTC [mailNxdActorSystem-akka.actor.default-dispatcher-2] c.c.S.m.MessageProcessorChildActor - Failed to send the mail to mail server. Reason: null
 2019-11-06 11:45:07:691 ERROR 16:45:07.691UTC [mailNxdActorSystem-akka.actor.default-dispatcher-2] c.c.S.m.MessageProcessorChildActor - Failed to send mail. Reason: java.lang.NullPointerException
 2019-11-06 11:45:07:691 ERROR 16:45:07.691UTC [mailNxdActorSystem-akka.actor.default-dispatcher-7] c.c.S.m.MessageProcessorMasterActor - Actor[akka://mailNxdActorSystem/user/supervisorActor/messageProcessorChildActor-Mail_4144_1768.req#-1076602369] failed to process the message. Reason: null
 2019-11-06 11:45:07:691 ERROR 16:45:07.691UTC [mailNxdActorSystem-akka.actor.default-dispatcher-3] a.actor.OneForOneStrategy - null
 java.lang.NullPointerException: null
  at com.ca.ServicePlus.mail.connection.JavaMailSMTPClient.sendMessage(JavaMailSMTPClient.java:267)
  at com.ca.ServicePlus.mail.connection.JavaMailSMTPClient.sendMail(JavaMailSMTPClient.java:325)
  at com.ca.ServicePlus.mailer.NXJavaMailMailer.sendMailToMailServer(NXJavaMailMailer.java:144)
  at com.ca.ServicePlus.mailer.NXMailMailerActor.lambda$createReceive$1(NXMailMailerActor.java:116)

Another example of a similar syntax error:

2022-03-16 09:50:14:889 ERROR  [mailNxdActorSystem-akka.actor.default-dispatcher-10] c.c.S.m.NXMessageToTargetMessageConverter - Failed to convert to JAVA MAIL
javax.mail.internet.AddressException: Illegal semicolon, not in group

This also leaves such mail messages in NX_ROOT/site/mail_queue 

Environment

Release : 17.1 and higher

Component : SERVICE DESK MANAGER

Cause

 Look at one of the sample emails in the NX_ROOT/site/mail_queue, Investigate for the syntax error listed in the "Failed to convert to JAVA MAIL" error

Failed to convert to JAVA MAIL javax.mail.internet.AddressException: Missing '<'

it would contain an email address value in the first line of the file, similar to  [email protected]>

It's the presence of the >  character at the end that's causing the issue. Javamail API is not able to find an appropriate <   in front of the string  (example:  <[email protected]>     or without any < > characters)

Resolution

Resolved the syntax issue mentioned in the JAVA MAIL error.

It will not fix the notifications left behind in NX_ROOT/site/mail_queue for that user. Those mails should be deleted and the user be notified about the same.