Gmail (or POP3) library for Android development

I am looking for a library for accessing Gmail that can handle attachments. Can someone point me to this please?

thanks

0
source share
2 answers

Gmail has Oauth protocol for access to IMAP and SMTP. Here you can learn more about this, including samples: http://code.google.com/apis/gmail/oauth/code.html

0
source

This link may be useful .....

http://www.jondev.net/articles/Sending_Emails_without_User_Intervention_%28no_Intents%29_in_Android

make changes to the sendMail section for attachment.

public synchronized void sendMail(String subject, String body, String sender, String recipients, File attachment) throws Exception { try{ MimeMessage message = new MimeMessage(session); message.setSender(new InternetAddress(sender)); message.setSubject(subject);MimeBodyPart mbp1 = new MimeBodyPart(); mbp1.setText(body); MimeBodyPart mbp2 = new MimeBodyPart(); FileDataSource fds = new FileDataSource(attachment); mbp2.setDataHandler(new DataHandler(fds)); mbp2.setFileName(fds.getName()); Multipart mp = new MimeMultipart(); mp.addBodyPart(mbp1); mp.addBodyPart(mbp2); message.setContent(mp); if (recipients.indexOf(',') > 0) message.setRecipients(Message.RecipientType.TO, InternetAddress.parse(recipients)); else message.setRecipient(Message.RecipientType.TO, new InternetAddress(recipients)); Transport.send(message); }catch(Exception e){ } }` 
+2
source

Source: https://habr.com/ru/post/885553/


All Articles