title: JavaMail: inline image in email
body: <p>I want to attached a inline image in mail body for this I am using the following method everything is fine but an attachment with 'noname' attached to email,I don't want any attachment in email I want to only display an image in email body , following is my code and the snapshot of the mail </p>
  
  <pre><code>public void forgotPasswordMail(String email,String token)
          {
                String to = email;
                Properties props = new Properties();
                props.put("mail.smtp.auth", "true");
                props.put("mail.smtp.starttls.enable", "true");
                props.put("mail.smtp.host", host);
                props.put("mail.smtp.port", "587");
                Session session = Session.getInstance(props,
                   new javax.mail.Authenticator() {
                      protected PasswordAuthentication getPasswordAuthentication() {
                         return new PasswordAuthentication(username, password);
                 }
                   });
                try {
                    MimeMessage message = new MimeMessage(session);
                    message.setSubject("HTML  mail with images");
                    message.setFrom(new InternetAddress("me@sender.com"));
                    message.addRecipient(Message.RecipientType.TO,
                         new InternetAddress("you@receiver.com"));
  
                    // Mail Body
                    MimeMultipart multipart = new MimeMultipart("related");
                    BodyPart textPart = new MimeBodyPart();
                    String htmlText ="&lt;img src=\"cid:image\"&gt; " + 
                    "&lt;html&gt;&lt;head&gt;&lt;style&gt;h1 {background-color: #FFF100;padding: 15px; text-indent: 40px;} " +
                            "p {text-indent: 60px;}&lt;/style&gt;&lt;/head&gt;&lt;body&gt;&lt;h1&gt;Forgot password request&lt;/h1&gt; " +
                            "&lt;p&gt; Please click on the following link to verify your account &lt;/p&gt;" + 
                            "&lt;p&gt;" + frontendUrl+"resetForgottonPassword/"+token+"&lt;/p&gt;&lt;/div&gt;&lt;/body&gt;&lt;/html&gt;";
                    textPart.setContent(htmlText, "text/html");
  
                    multipart.addBodyPart(textPart);
                    BodyPart imagePart = new MimeBodyPart();
                    DataSource fds = new FileDataSource
                      ("C:/Users/INTERN I/Desktop/logo2.png");
                    imagePart.setDataHandler(new DataHandler(fds));
                    imagePart.setHeader("Content-ID","&lt;image&gt;");
                    imagePart.setDisposition(MimeBodyPart.INLINE);
                    multipart.addBodyPart(imagePart);
                    message.setContent(multipart);
                    message.setSubject("Reset Password");
                    message.setRecipients(Message.RecipientType.TO,
                             InternetAddress.parse(to));
                    Transport.send(message);
                } catch (MessagingException e) {
                   throw new RuntimeException(e);
                }
             }
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/5jDPp.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/5jDPp.png" alt="SnapShot of Email"></a></p>