Skip to main content
Level 2
Jan 28, 2025 4:40 PM UTC
Solved

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

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?

 

dpkhmhsAccepted solution
Level 2
Feb 3, 2025 3:24 PM UTC

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.

5 replies

Khushwant_Singh
Adobe Employee
Adobe Employee
Jan 30, 2025 2:07 AM UTC

@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.

Translate
Khushwant_Singh
Adobe Employee
Adobe Employee
Feb 3, 2025 9:03 AM UTC

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

Translate
Level 2
Feb 13, 2026 10:12 AM UTC

The error "javax.mail.internet.AddressException: Illegal address" usually occurs when an email address is formatted incorrectly or has invalid characters, causing intermittent issues when submitting forms. Double-checking addresses often fixes the problem quickly.

For more helpful tips, check out how to pasaload tm to globe.

Translate