È possibile creare un client di posta elettronica personalizzato per Gmail utilizzando le API Java?
O solo Google può farlo?
Sì, puoi connetterti a Gmail usando IMAP e POP3. In altre parole, è possibile utilizzare qualsiasi client IMAP / POP3 (come Mozilla Thunderbird o Outlook). Puoi anche scrivere il tuo cliente utilizzando il client IMAP Java.
Sì, puoi ecco un esempio che ho fatto per il progetto college, prova a cambiare il server yahoo sul server Gmail
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();
}
}