私は週末を Google App Engine と Google Web Toolkit で遊んで過ごしましたが、うまくやって簡単なアプリを作成しました。
つまずきは電子メールの送信にあるようです。私のコードは次のとおりです。
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();
}
}
これを開発サーバーで実行すると、送信されたはずのメールに関するログがコンソールに出力されます。App Engine にデプロイして試してみると、何も起こらず、メールが届きません。
クォータの詳細を調べると、そこにメール API 呼び出しが表示されます。ログを見ると、エラーはありません (ただし、そこにログが表示されません...)。
これを送信するために基本的に料金が請求されている (クォータを使い果たした) のに、実際にメールが届かないのは奇妙に思えます。
ところで、スパムフォルダをチェックしました。