2013-02-17 52 views
0

我已经在周末玩Google App Engine和Google Web Toolkit,并且相处得很好,并且构建了一个简单的应用。Google应用引擎不会发送邮件,尽管呼叫出现在配额详细信息中

绊脚石似乎在发送电子邮件。我的代码是:

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。

回答

3

看来您使用的gmail帐户是一个Project Viewer。 docs state它应该是一个开发人员。

+0

我尝试将帐户的所有者更改为开发人员(尽管实际上并未在文档中找到该位,但它只是表示管理员相信查看者),但电子邮件仍未发送。 无论如何,谢谢 – Roaders 2013-02-19 13:19:18

0

最后我刚刚使用了当前登录用户的电子邮件地址 - 这始终是管理员,因为如果您是管理员,则只能访问该应用的这部分内容。 我无法使用属于某个管理员的硬连线地址进行工作。

相关问题