Expand my Community achievements bar.

SOLVED

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

Avatar

Level 2

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?

 

Topics

Topics help categorize Community content and increase your ability to discover relevant content.

1 Accepted Solution

Avatar

Correct answer by
Level 2

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.

View solution in original post

4 Replies

Avatar

Moderator

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

Avatar

Moderator

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

Avatar

Correct answer by
Level 2

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.

Avatar

Moderator

Thanks a lot for sharing these details, @dpkhmhs! Hopefully, this issue won’t come up again. But if it does, just let us know!