-1

Is it possible to build a custom email client for Gmail using Java APIs?

Or only Google can do that?

1
  • 5
    This question appears to be off-topic because it doesn't demonstrate a minimal understanding of the problem being solved.
    – Jim G.
    Sep 24, 2013 at 13:42

2 Answers 2

5

Yes, you can connect to Gmail using IMAP and POP3. In other words, you can use any (?) IMAP/POP3 client, such as Mozilla Thunderbird or Outlook. You can also write your own client using Java IMAP client.

4
  • 1
    would you mind explaining more on what it does and why do you recommend it as answering the question asked? "Link-only answers" are not quite welcome at Stack Exchange
    – gnat
    Sep 24, 2013 at 13:47
  • +1 Nitra. @gnat. The link answers the question: "how to build a custom email client for Gmail using Java APIs". The link is to StackOverflow, which is another Stack Exchange site. This question is a near-duplicate of the linked question (not quite exact duplicate because this question implicitly covers sending as well as receiving email).
    – MarkJ
    Sep 24, 2013 at 16:24
  • @MarkJ with all due respect, the advertized link says - "I want to access messages in GMail from a Java application using JavaMail and IMAP. Why am I getting a SocketTimeoutException?" - how does this answer the question asked here?
    – gnat
    Sep 24, 2013 at 16:27
  • 1
    it's quite a funny belief that stuffing internal (programmers / SO / whatever.SE) links somehow salvages link-only garbage. Not to mention that target posts are sometimes deleted, leading to plain link rot, posters don't even realize how bad it may look for the readers who click the links and can't figure how these are relevant
    – gnat
    Sep 24, 2013 at 16:32
-2

Yes you can here is an example I made for college project, try change the yahoo server to Gmail server

      import java.io.BufferedReader;
      import java.io.IOException;
      import java.io.InputStreamReader;
      import java.io.OutputStreamWriter;
      import java.io.PrintWriter;
      import java.net.Socket;
      import java.net.UnknownHostException;
      import javax.swing.JOptionPane;

      public class Email {




      public static void main(String[] args) throws UnknownHostException,IOException    {


      Socket so = new Socket("smtp.mail.yahoo.com",25); // you change this to google's email sever   

         BufferedReader inputStream = new BufferedReader(new InputStreamReader(so.getInputStream()));
PrintWriter outputStream   = new PrintWriter(new OutputStreamWriter(so.getOutputStream()),true);    




    String enemail   =  JOptionPane.showInputDialog(null, "Enter your e-mail in BASEA64 code");
    String password  =  JOptionPane.showInputDialog(null, "Enter your password in BASEA64 code");
    String from      =  JOptionPane.showInputDialog(null, "From");
    String to        =  JOptionPane.showInputDialog(null, "To");
    String subject   =  JOptionPane.showInputDialog(null, "Subject");
    String msg       =  JOptionPane.showInputDialog(null, "Message");

    outputStream.println("HELO ");      
    System.out.println(inputStream.readLine());



    outputStream.println("AUTH LOGIN");     
    System.out.println(inputStream.readLine());


    //You enter your e-mail here , in BASE64 code

    outputStream.println(enemail);      
    System.out.println(inputStream.readLine());


    //You enter your password here , in BASE64 code
    outputStream.println(password);     
    System.out.println(inputStream.readLine());


    outputStream.println("VRFY");       
    System.out.println(inputStream.readLine());

    outputStream.println("MAIL FROM:<"+from+">");       
    System.out.println(inputStream.readLine());


    outputStream.println("RCPT TO:<"+to+">");       
    System.out.println(inputStream.readLine());

    outputStream.println("DATA");       
    System.out.println(inputStream.readLine());


    outputStream.println("Subject:"+subject);
    outputStream.println("FROM :<"+from+">");
    outputStream.println("TO :<"+to+">");
    outputStream.println(msg);
    outputStream.println("");       
    outputStream.println(".");      
    so.close();




             }


 }
2
  • 1
    how does this answer the question asked? See: How to Answer
    – gnat
    Sep 24, 2013 at 13:47
  • maybe change the yahoo e-mail to gmail ?!
    – fady taher
    Sep 24, 2013 at 13:53

Not the answer you're looking for? Browse other questions tagged or ask your own question.