javaemailgrailsgrails-plugingrails-2.0

Grails Mail plugin headers is not correctly generated


I have two equal grails 2.2.3 (jdk 7) projects with same BuildConfig and Config. I am using this plugin :

compile ":mail:1.0.7"

In one of the projects the mail is sent with this data :

DATA
Thread-21, WRITE: TLSv1.2 Application Data, length = 48
Thread-21, READ: TLSv1.2 Application Data, length = 96
354 Start mail input; end with <CRLF>.<CRLF>
Date: Sat, 10 Jun 2023 20:05:47 +0330 (GMT+03:30)
From: a@b
To: a@b
Cc: a@b
Message-ID: <1632286266.2.1686415318488.JavaMail.a@b>
Subject: test
MIME-Version: 1.0
Content-Type: text/html;charset=utf-8
Content-Transfer-Encoding: base64

PGRpdiBzdHlsZT0idGV4dC1hbGlnbjogcmlnaHQ7ZGlyZWN0aW9uOiBydGw7Ij4gPHAgc3R5bGU9
InRleHQtYWxpZ246cmlnaHQgLCB0eXBlPSJ0ZXh0Ij7YrNmH2Kog2YXYtNin2YfYr9mHINmI2LbY
uduM2Kog2YbZh9in24zbjCDar9iy2KfYsdi02KfYqiDZvtuM2LTYsdmB2KrZhyDZiCDYp9mF2Krb
jNin2LIg2KfYudiq2KjYp9ix24wg2YXYtNiq2LHbjCDYqNmHINqp2KfYsdiq2KfYqNmEINmF2LHY
qNmI2LfZhyDZhdix2KfYrNi52Ycg2KjZgdix2YXYp9uM24zYryA8cD48L2Rpdj4=

and in the other one the data is incomplete and because of the charset and subject the email is not human readable :

DATA
354 Start mail input; end with <CRLF>.<CRLF>

PGRpdiBzdHlsZT0idGV4dC1hbGlnbjogcmlnaHQ7ZGlyZWN0aW9uOiBydGw7Ij4gPHAgc3R5bGU9
InRleHQtYWxpZ246cmlnaHQgLCB0eXBlPSJ0ZXh0Ij7YrNmH2Kog2YXYtNin2YfYr9mHINmI2LbY
uduM2Kog2YbZh9in24zbjCDar9iy2KfYsdi02KfYqiDZvtuM2LTYsdmB2KrZhyDZiCDYp9mF2Krb
jNin2LIg2KfYudiq2KjYp9ix24wg2YXYtNiq2LHbjCDYqNmHINqp2KfYsdiq2KfYqNmEINmF2LHY
qNmI2LfZhyDZhdix2KfYrNi52Ycg2KjZgdix2YXYp9uM24zYryA8cD48L2Rp

I noticed that the object structure for creating the message is different a little bit, but I am only using the plugin files. I don't know where is it coming from. First Data structure Image : enter image description here

Second Data structure Image : enter image description here


Solution

  • The problem was that 4 jar files had the same package and class name in the second project so the old version of the MimeMessage class was loaded. check this link : grails 2 different dependencies with same package names