Hi Ed,
I am not 100% sure to understand what you want to do, but if you want your application users to enter their e-mail address in a form, then click a "send" button and have your AppEngine backend fecthing data from Cloud datastore and send an email with this data to the user's e-mail address you can do it by running a background task using queues, as follow:
1/Write a servlet that will send the mail (i.e. write the code to perform the task.). Example:
public class SendConfirmationEmailServlet extends HttpServlet {
@Override
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
String email = request.getParameter("email"); //User's email
try {
Message msg = new MimeMessage(session);
msg.setFrom(new InternetAddress(“
your...@gmail.com", “Your Name“));
msg.addRecipient(
Message.RecipientType.TO,
new InternetAddress(email, “User Name“));
msg.setSubject(“Subject”);
String htmlBody = “Hi” + e.g. some data from the datastore through Objectify for instance;
Multipart mp = new MimeMultipart();
MimeBodyPart htmlPart = new MimeBodyPart();
htmlPart.setContent(htmlBody, "text/html");msg.setContent(mp);
Transport.send(msg);
} catch (....) {
...
}
}
}
2/ Configure the queue in queue.xml See
https://cloud.google.com/appengine/docs/java/taskqueue/3/ Add the task to the the queue from another Servlet or an Endpoint , like
queue.add(TaskOptions.Builder.withURL(URL_for_task).
param(param1).param(param2);
4/ From you HTML front end, through the JavaScript Library call your Servlet or Endpoint with the desired parameters.
Tell me if this is what you are looking for: If yes I could describe the process with much more details and/or point you to some examples.
Hope this helps.
Renaud