我在周末玩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();
}
}
当我在开发服务器上运行此日志时,会在控制台中打印出有关已发送邮件的日志。 当我部署到应用程序引擎并尝试没有任何反应时,我没有收到任何邮件。
如果我查看配额详情,我可以在那里看到邮件api电话。如果我查看日志没有错误(但我看不到我的日志......)。
我基本上已经收取了发送费用(配额已用完),但实际上并没有收到任何邮件,这似乎很奇怪。
我已查看我的垃圾邮件文件夹BTW。
答案 0 :(得分:3)
您使用的gmail帐户似乎是Project Viewer。它应该是开发人员的docs state。
答案 1 :(得分:0)
最后,我只使用了当前登录用户的电子邮件地址 - 这始终是管理员,因为如果您是管理员,则只能访问应用程序的这一部分。 我无法使用属于其中一个管理员的硬连线地址来使用它。