继续使用Google App Engine返回错误:API错误1(邮件:INTERNAL_ERROR):内部错误

时间:2011-11-22 16:58:50

标签: google-app-engine email go

我有点失落。通过GAE发送电子邮件似乎不起作用。抛出的错误是: Couldn't send email: API error 1 (mail: INTERNAL_ERROR): Internal error

我尝试了几种不同的发件人地址,但似乎始终。有时它有时会起作用。在本地每一个似乎都很好(当然没有邮件发送,但日志显示发送假设的电子邮件)。 代码:

func (coinflip *Coinflip) mailParticipants(context appengine.Context, key *datastore.Key)     {
  participants, _, _ := coinflip.fetchParticipants(context)
  for i := range coinflip.Participants {
    msg := &mail.Message{
                  Sender:  "X...@gmail.com",
                  ReplyTo: "X...@gmail.com",
                  To:      []string{participants[i].Email},
                  Subject: "What will it be? " + coinflip.Head + " or " + coinflip.Tail + "?",
                  Body:    fmt.Sprintf(confirmMessage, "http://www.flipco.in/register/" + key.Encode() + "?email=" + participants[i].Email),
      }
    if err := mail.Send(context, msg); err != nil {
        context.Errorf("Couldn't send email: %v", err)
    }
  }
}

const confirmMessage = `
Someone created a coin toss with you.
Please confirm your email address by clicking on the link below:

%s
`

完整的代码可以在Github上找到:https://github.com/haarts/flipco.in

感谢您的帮助!

亲切的问候,

1 个答案:

答案 0 :(得分:2)

你的appid是什么?有一个已知问题,如果您的appid与用于创建应用程序的gmail帐户名相同,则邮件发送将失败。见这里:http://code.google.com/p/googleappengine/issues/detail?id=5320