Note that there are some explanatory texts on larger screens.

plurals
  1. POJavaMail content-transfer-encoding issue
    primarykey
    data
    text
    <p>I have some Java code which sends out an email with code somewhat like the following: Actually i got Mimemessage from Httprequest param and in that mimemessage i'm going to append some content to existing body.</p> <p>If Mimemessage is of Multipart content-type , i'm not facing any issue while sending message.</p> <p>If the message is of text/plain and text/html content-type, the content-transfer encoding which i set didn't applied to body.</p> <p>Based on this <a href="http://www.oracle.com/technetwork/java/faq-135477.html" rel="nofollow">docs</a></p> <p>Q: Even though JavaMail does all the encoding and decoding for me, I need to manually control the encoding for some body parts. A: In the rare case that you need to control the encoding, there are several ways to override JavaMail's default behavior. A simple approach is as follows. After creating the entire message, call msg.saveChanges() and then use something like mbp.setHeader("Content-Transfer-Encoding", "base64") to force base64 encoding for the given body part.</p> <p>Another approach is to subclass MimeBodyPart and override the updateHeaders method so that it first calls super.updateHeaders() and then sets the Content-Transfer-Encoding header as above.</p> <p>Applied above also. But it doesn't works for me.</p> <pre><code>InputStream ins = request.getInputStream(); MimeMessage msg = new MimeMessage(session,ins); msg.setContent("some non-Ascii content","text/plain; charset="UTF-8""); //Tried setheader before saveChanges() method, also doesn't work for me //msg.setHeader("Content-Transfer-Encoding","base64"); msg.saveChanges(); //Now tried based on above docs after saveChanges method, also doesn't work msg.setHeader("Content-Transfer-Encoding","base64"); </code></pre> <p>please help to solve this.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload