1

How to use javaMail API in android for receiving mail with attachment.
Pls give me some code or steps which is use in Android.

djot
  • 2,952
  • 4
  • 19
  • 28
Sandip Armal Patil
  • 6,241
  • 21
  • 93
  • 160

1 Answers1

1

Please Do some R&D before posting.what you tried before posting this Question? check this how to getAuth token and send email in background?
For attachment you can use this. i have given some sample to attach image from your gallery.

 MimeBodyPart attachmentPart = new MimeBodyPart();
    FileDataSource fileDataSource = new FileDataSource(path_img) {
        @Override
        public String getContentType() {
            return "image/jpg";
        }
    };
    attachmentPart.setDataHandler(new DataHandler(fileDataSource));
    attachmentPart.setFileName("image.jpg");

    multipart.addBodyPart(messageBodyPart);
   multipart.addBodyPart(attachmentPart);

    message.setContent(multipart);
Community
  • 1
  • 1
OnkarDhane
  • 1,450
  • 2
  • 14
  • 24