"javax.mail.internet.AddressException: Illegal address" happens intermittently when submitting forms | Community
Skip to main content
Level 2
January 28, 2025
Solved

"javax.mail.internet.AddressException: Illegal address" happens intermittently when submitting forms

  • January 28, 2025
  • 1 reply
  • 1261 views

AEM 6.5, SPA, Angular 9, Bootstrap 4

AEM Forms packages:

adobe-aemfd-linux-pkg-6.0.1120.zip

adobe-aemfd-compat-pkg-2.0.48.zip

Sometimes a submission fails for no obvious reason in the UI. When we look in error.log, we see errors about an "Illegal address".  We've been unable to come up with steps to reproduce the issue as it happens intermittently across forms.  Email addresses used for the form's TO and FROM fields are correctly formatted.  AEM mail server configuration confirmed to be correct by Adobe support.  Stacktrace:

 

31.12.2024 08:49:14.161 *ERROR* [IP removed [1735652954103] POST /path/to/form/jcr:content/guideContainer.af.submit.jsp HTTP/1.1] com.adobe.aemds.guide.service.impl.MailSubmitActionService Could not create emailIllegal address javax.mail.internet.AddressException: Illegal address at javax.mail.internet.InternetAddress.<init>(InternetAddress.java:122) at com.adobe.aemds.guide.internal.impl.utils.GuideEmail.createEmail(GuideEmail.java:122) at com.adobe.aemds.guide.service.impl.MailSubmitActionService.submit(MailSubmitActionService.java:80)

 

  1. Has anybody else seen this behavior?
  2. This seems like a symptom of some other root cause.  Is there something non-obvious I should be looking for?  Other AEM logs besides error.log?  Something on the mail server side?  Any troubleshooting tips?

 

Best answer by dpkhmhs

I tried a number of special characters, but still couldn't reproduce the issue.  I was able to test passing in an empty string (blank) for the TO address via the form send email submit action configuration.  That reproduced the issue.

We have a hidden field that programmatically determines the correct TO email address when the field is initialized.  The field's default value is blank.

I applied two changes to make sure this issue didn't happen again.

  1. To more reliably make sure the field is initialized, I wrapped that code with guideBridge.connect(handler, context);
  2. If the field still didn't properly initialize, I set a default value for the field.

Hopefully these two changes will prevent the TO email from being blank in the future.

1 reply

Khushwant_Singh
Adobe Employee
Adobe Employee
January 30, 2025

@dpkhmhs 

Customers have previously faced such issue when an email address contains an invalid Unicode character, causing errors.For example, if the “To” address in a form has a hidden zero-width space character (0x200b) at the end, it may not be visible but can still cause problems. Removing such characters from the configuration should resolve the issue.

Khushwant_Singh
Adobe Employee
Adobe Employee
February 3, 2025

@dpkhmhs, Is the issue resolved? Or are you looking for additional information?