2011-01-09 1 views
0

Je suis à la recherche d'une bibliothèque pour accéder à Gmail qui peut gérer les pièces jointes. Quelqu'un peut-il me diriger vers ce s'il vous plaît?Bibliothèque Gmail (ou POP3) pour le développement Android

Merci

+0

Il y a un port de messagerie javax pour Android. Pour un exemple et des références, lisez ceci autre [réponse] (http://stackoverflow.com/questions/2020088/sending-email-in-android-using-javamail-api-without-using-the-default-android- a/2033124 # 2033124). – espinielli

Répondre

2

Ce lien pourrait être utile .....

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

apporter des modifications à la section sendMail pour la fixation ..

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){ 

    } 
}` 
Questions connexes