Im Anschluss an das Senden einer einfachen E-Mail mit diesem Code mit Google App Engine. Aber nichts passiert, gibt es etwas, das ich konfigurieren muss, um die Mail API zu verwenden? Dies läuft auf localhost. Ich verwende Gmail als Mail-Host.Senden von E-Mails mit Google App-Engine
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);
Gibt es also keine Möglichkeit, eine E-Mail von einem GAE-Projekt zu senden? Oder einfach nicht auf diese Weise? – Nick
Sie können nur von bestimmten Adressen und dem lokalen Entwicklungsserver nur E-Mails an die Konsole protokollieren – jimr