title: Spring Mail inline Images not getting attached
body: <p>I Have written a code for sending mails with inline images.</p>
  
  <pre><code>final MimeMessagePreparator messagePreparator = new MimeMessagePreparator() {
                  @Override
                  public void prepare(MimeMessage mimeMessage) throws Exception {
                      MimeMessageHelper mimeMessageHelper = new MimeMessageHelper(mimeMessage, MimeMessageHelper.MULTIPART_MODE_RELATED);
                      mimeMessageHelper.setTo(mailTo);
  
                      mimeMessageHelper.setSubject(subject);
                      mimeMessageHelper.setText(mailContent,true);
                      InternetAddress fromAddress = new InternetAddress(mailFromEmail,mailFromName);
                      mimeMessageHelper.setFrom(fromAddress);
                      for(String inlineImage : inlineImages) {
                          attachImage(mimeMessageHelper, inlineImage);
                      }
  
                  }
              };
  </code></pre>
  
  <p>An this code was working perfectly. 
  But later on it was required to send the mail in some regional language and so the code fails.
  So I change my code to </p>
  
  <pre><code>final MimeMessagePreparator messagePreparator = new MimeMessagePreparator() {
                  @Override
                  public void prepare(MimeMessage mimeMessage) throws Exception {
                      MimeMessageHelper mimeMessageHelper = new MimeMessageHelper(mimeMessage, MimeMessageHelper.MULTIPART_MODE_RELATED);
                      mimeMessageHelper.setTo(mailTo);
  
                      /**
                       * for allowing UTF-8 encoding in mail body ie support for regional languages
                       */
  
                      MimeBodyPart att = new MimeBodyPart();
                      att.setText(mailContent, "UTF-8", "plain");
                      att.addHeader("Content-Type", "text/html; charset=UTF-8");
  
                      Multipart multipart = new MimeMultipart();
                      multipart.addBodyPart(att);
                      mimeMessage.setContent(multipart);
  
                      /**
                       * for allowing UTF-8 encoding in mail body ie support for regional languages ends
                       */
  
                      mimeMessageHelper.setSubject(subject);
  //                    mimeMessageHelper.setText(mailContent,true);
                      InternetAddress fromAddress = new InternetAddress(mailFromEmail,mailFromName);
                      mimeMessageHelper.setFrom(fromAddress);
                      for(String inlineImage : inlineImages) {
                          attachImage(mimeMessageHelper, inlineImage);
                      }
                  }
              };
  </code></pre>
  
  <p>attachImage method is : </p>
  
  <pre><code>private void attachImage(MimeMessageHelper mimeMessageHelper,String imageName) throws MessagingException{
          mimeMessageHelper.addInline(imageName, new ClassPathResource("mailimg/" + imageName));
      }
  </code></pre>
  
  <p>Now language is showing fine but the inline images are not getting attached. I am not getting if the language support is not how it meant to be or anything else.
  Any help will be highly appreciated.</p>