Base64: java.lang.IllegalArgumentException: Illegal character

后端 未结 5 1926
醉梦人生
醉梦人生 2020-11-30 11:09

I\'m trying to send a confirmation email after user registration. I\'m using the JavaMail library for this purpose and the Java 8 Base64 util class.

I\'m encoding us

5条回答
  •  再見小時候
    2020-11-30 11:40

    Your encoded text is [B@6499375d. That is not Base64, something went wrong while encoding. That decoding code looks good.

    Use this code to convert the byte[] to a String before adding it to the URL:

    String encodedEmailString = new String(encodedEmail, "UTF-8");
    // ...
    String confirmLink = "Complete your registration by clicking on following"
        + "\nlink";
    

提交回复
热议问题