2013-02-17 50 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

最後我剛剛使用了當前登錄用戶的電子郵件地址 - 這始終是管理員,因爲如果您是管理員,則只能訪問該應用的這部分內容。 我無法使用屬於某個管理員的硬連線地址進行工作。

相關問題