簡體   English   中英

盡管有呼叫出現在配額詳細信息中,但Google App引擎仍未發送郵件

[英]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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM