java.lang.IllegalArgumentException: Invalida e-mail address: <address_with&amp;character@acme.com>

Sonatype JIRA | Sylvain Baudoin | 2 years ago
tip
Click on the to mark the solution that helps you, Samebug will learn from it.
As a community member, you’ll be rewarded for you help.
  1. 0

    Our internal functional mailbox has a '&' character in its address. I would like to set this e-mail address as the system email in the SMTP settings so that Nexus can send notification. The problem is that Nexus claims that this is an invalid e-mail address, although I can send mails from another mailbox (e.g. Gmail) and there is an option, as per RFC 822, using quotes to have special characters in e-mail addresses. So how to set an e-mail address with '&' in it? Nexus shows a short pop-up with a 500 error and generates the following stacktrace: {code}2015-08-26 14:48:58 ERROR [qtp26197757-103] - org.sonatype.nexus.rest.NexusApplication - Unhandled exception or error intercepted java.lang.IllegalArgumentException: Invalida e-mail address: <address_with&amp;character@acme.com> at org.sonatype.micromailer.Address.validateAddress(Address.java:115) ~[sisu-mailer-1.8.jar:1.8] at org.sonatype.micromailer.Address.<init>(Address.java:44) ~[sisu-mailer-1.8.jar:1.8] at org.sonatype.micromailer.Address.<init>(Address.java:36) ~[sisu-mailer-1.8.jar:1.8] at org.sonatype.nexus.rest.global.GlobalConfigurationPlexusResource.put(GlobalConfigurationPlexusResource.java:256) ~[nexus-restlet1x-plugin-2.10.0-02/:na] at org.sonatype.plexus.rest.resource.RestletResource.storeRepresentation(RestletResource.java:299) ~[nexus-restlet1x-plugin-2.10.0-02/:na] at org.sonatype.nexus.rest.NexusRestletResource.storeRepresentation(NexusRestletResource.java:91) ~[nexus-restlet1x-plugin-2.10.0-02/:na] ... Caused by: javax.mail.internet.AddressException: Local address contains illegal character at javax.mail.internet.InternetAddress.checkAddress(InternetAddress.java:1216) ~[mail-1.4.7.jar:1.4.7] at javax.mail.internet.InternetAddress.validate(InternetAddress.java:1129) ~[mail-1.4.7.jar:1.4.7] at org.sonatype.micromailer.Address.getInternetAddress(Address.java:61) ~[sisu-mailer-1.8.jar:1.8] at org.sonatype.micromailer.Address.validateAddress(Address.java:111) ~[sisu-mailer-1.8.jar:1.8] ... 131 common frames omitted {code}

    Sonatype JIRA | 2 years ago | Sylvain Baudoin
    java.lang.IllegalArgumentException: Invalida e-mail address: <address_with&amp;character@acme.com>

    Root Cause Analysis

    1. java.lang.IllegalArgumentException

      Invalida e-mail address: <address_with&amp;character@acme.com>

      at org.sonatype.micromailer.Address.validateAddress()
    2. org.sonatype.micromailer
      Address.<init>
      1. org.sonatype.micromailer.Address.validateAddress(Address.java:115)[sisu-mailer-1.8.jar:1.8]
      2. org.sonatype.micromailer.Address.<init>(Address.java:44)[sisu-mailer-1.8.jar:1.8]
      3. org.sonatype.micromailer.Address.<init>(Address.java:36)[sisu-mailer-1.8.jar:1.8]
      3 frames
    3. Nexus Core
      GlobalConfigurationPlexusResource.put
      1. org.sonatype.nexus.rest.global.GlobalConfigurationPlexusResource.put(GlobalConfigurationPlexusResource.java:256)[nexus-restlet1x-plugin-2.10.0-02/:na]
      1 frame
    4. ${project.groupId}:${project.artifactId}
      RestletResource.storeRepresentation
      1. org.sonatype.plexus.rest.resource.RestletResource.storeRepresentation(RestletResource.java:299)[nexus-restlet1x-plugin-2.10.0-02/:na]
      1 frame
    5. Nexus Core
      NexusRestletResource.storeRepresentation
      1. org.sonatype.nexus.rest.NexusRestletResource.storeRepresentation(NexusRestletResource.java:91)[nexus-restlet1x-plugin-2.10.0-02/:na]
      1 frame