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

Or only Google can do that?

closed as off-topic by Jim G., GlenH7, Alex Feinman, user40980, gnat Sep 25 '13 at 3:33

  • This question does not appear to be about software engineering within the scope defined in the help center.
If this question can be reworded to fit the rules in the help center, please edit the question.

  • 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 '13 at 13:42

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.

  • 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 '13 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 '13 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 '13 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 '13 at 16:32

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 ");      

    outputStream.println("AUTH LOGIN");     

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


    //You enter your password here , in BASE64 code


    outputStream.println("MAIL FROM:<"+from+">");       

    outputStream.println("RCPT TO:<"+to+">");       


    outputStream.println("FROM :<"+from+">");
    outputStream.println("TO :<"+to+">");


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

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