Im ima per inviare una semplice email con questo codice utilizzando il motore di app di google. Ma non succede nulla, c'è qualcosa che devo configurare per usare l'API di posta? Funziona su localhost. Sto usando gmail come host di posta.Invio di posta elettronica con il motore di app di google
String host = "smtp.google.com";
String to = "[email protected]";
String from = "[email protected]";
String subject = "this is a test";
String messageText = "test";
boolean sessionDebug = false;
// Create some properties and get the default Session.
Properties props = System.getProperties();
props.put("mail.host", host);
props.put("mail.transport.protocol", "smtp");
Session mailSession = Session.getDefaultInstance(props, null);
// Set debug on the Session
// Passing false will not echo debug info, and passing True will.
mailSession.setDebug(sessionDebug);
// Instantiate a new MimeMessage and fill it with the
// required information.
Message msg = new MimeMessage(mailSession);
msg.setFrom(new InternetAddress(from));
InternetAddress[] address = { new InternetAddress(to) };
msg.setRecipients(Message.RecipientType.TO, address);
msg.setSubject(subject);
msg.setSentDate(new Date());
msg.setText(messageText);
// Hand the message to the default transport service
// for delivery.
Transport.send(msg);
Quindi non c'è modo di inviare un messaggio di posta elettronica da un progetto GAE? O semplicemente non usare in questo modo? – Nick
È possibile, solo da indirizzi specifici e il server di sviluppo locale registra le e-mail nella console – jimr