Reputation: 4525
I have spent the weekend playing with Google App Engine and Google Web Toolkit and have got along pretty well and built a simple app.
The stumbling block seems to be sending e-mails. My code is:
private void sendOffenderMail( OffenceDetails offence )
{
if( offence.email == null || offence.email.equals("") )
{
return;
}
Properties props = new Properties();
Session session = Session.getDefaultInstance(props, null);
String msgBody = "You have been added to the list";
if( offence.notes != null && !offence.notes.equals( "" ) )
{
msgBody += "\n\nThe following notes were included:\n\n" + offence.notes;
}
Message msg = new MimeMessage(session);
try {
msg.setFrom( new InternetAddress(<gmail account belonging to project viewer>, "List Admin") );
msg.addRecipient(
Message.RecipientType.TO,
new InternetAddress (offence.email, offence.name )
);
msg.setSubject("You've been added to the list...");
msg.setText(msgBody);
Transport.send(msg);
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
} catch (MessagingException e) {
e.printStackTrace();
}
}
When I run this on the development server logs get printed out in the console about the mail that would have been sent. When I deploy to app engine and try there nothing happens, I don't get any mail.
If I look in to the quota details I can see mail api calls there. If I look at the logs there are no errors (but I can't see and of my logs in there...).
It seems odd that I have essentially been charged for sending this (quota used up) but no mails actually got through.
I HAVE checked my spam folder BTW.
Upvotes: 0
Views: 528
Reputation: 4525
In the end I just used the e-mail address of the currently logged in user - which is always an admin as you can only get to this part of the app if you're an admin. I could not get it to work using a hardwired address belonging to one of the admins.
Upvotes: 0
Reputation: 80330
It seems that gmail account that you use is a Project Viewer. The docs state that it should be a Developer.
Upvotes: 3