简体   繁体   English

尽管有呼叫出现在配额详细信息中,但Google App引擎仍未发送邮件

[英]Google app engine not sending mail despite calls appearing in Quota details

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. 我度过了一个周末,使用Google App Engine和Google Web Toolkit,相处得很好,并构建了一个简单的应用程序。

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. 当我部署到App Engine并尝试进行任何操作时,我没有收到任何邮件。

If I look in to the quota details I can see mail api calls there. 如果查看配额详细信息,则可以在其中看到邮件api调用。 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. 我已经检查了我的垃圾邮件文件夹BTW。

It seems that gmail account that you use is a Project Viewer. 您使用的gmail帐户似乎是Project Viewer。 The docs state that it should be a Developer. 文档指出它应该是开发人员。

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. 我无法使用属于其中一位管理员的固定地址来工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM