[英]Google app engine not sending mail despite calls appearing in Quota details
我度过了一个周末,使用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调用。 如果我查看日志,则没有错误(但是我看不到其中的日志……)。
从本质上讲,我已经为此发送费用(用完了配额)而感到费解,但实际上没有邮件通过。
我已经检查了我的垃圾邮件文件夹BTW。
您使用的gmail帐户似乎是Project Viewer。 文档指出它应该是开发人员。
最后,我只使用了当前登录用户的电子邮件地址-始终是管理员,因为只有管理员才能访问该应用程序的这一部分。 我无法使用属于其中一位管理员的固定地址来工作。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.