SMTPServerDisconnected问题

时间:2009-05-25 11:51:54

标签: google-app-engine smtp

我的Google应用引擎应用需要发送电子邮件(我们从屏幕上获取数据)。在开发服务器上,我在启动服务器时指定我的smtp配置(主机,端口,用户,密码)。然后我在提交数据显示错误

之后以该表单运行我的应用程序
**Traceback (most recent call last):
  File "C:\Program Files\Google\google_appengine\google\appengine\ext\webapp\__init__.py", line 500, in __call__
    handler.post(*groups)
  File "C:\Documents and Settings\desk\Desktop\apps\temp\main.py", line 139, in post
    """)
  File "C:\Program Files\Google\google_appengine\google\appengine\api\mail.py", line 205, in send_mail
    message.send(make_sync_call)
  File "C:\Program Files\Google\google_appengine\google\appengine\api\mail.py", line 474, in send
    make_sync_call('mail', self._API_CALL, message, response)
  File "C:\Program Files\Google\google_appengine\google\appengine\api\apiproxy_stub_map.py", line 68, in MakeSyncCall
    apiproxy.MakeSyncCall(service, call, request, response)
  File "C:\Program Files\Google\google_appengine\google\appengine\api\apiproxy_stub_map.py", line 240, in MakeSyncCall
    stub.MakeSyncCall(service, call, request, response)
  File "C:\Program Files\Google\google_appengine\google\appengine\api\apiproxy_stub.py", line 80, in MakeSyncCall
    method(request, response)
  File "C:\Program Files\Google\google_appengine\google\appengine\api\mail_stub.py", line 203, in _Send
    self._SendSMTP(mime_message, smtp_lib)
  File "C:\Program Files\Google\google_appengine\google\appengine\api\mail_stub.py", line 139, in _SendSMTP
    smtp.quit()
  File "C:\Python26\lib\smtplib.py", line 730, in quit
    res = self.docmd("quit")
  File "C:\Python26\lib\smtplib.py", line 362, in docmd
    self.putcmd(cmd,args)
  File "C:\Python26\lib\smtplib.py", line 318, in putcmd
    self.send(str)
  File "C:\Python26\lib\smtplib.py", line 310, in send
    raise SMTPServerDisconnected('please run connect() first')
SMTPServerDisconnected: please run connect() first**

它告诉SMTPServerDisconnected,请先运行connect() 以下代码我正在使用

mail.send_mail(发件人= “abc@xyz.com”,               到= “def@xyz.com”,               subject =“测试消息”,               体=“””               亲爱的阿尔伯特:

          Your example.com account has been approved.  You can now visit
          http://www.example.com/ and sign in using your Google Account to
          access new features.

          Please let us know if you have any questions.

          The example.com Team
          """)

请告诉我这段代码有什么问题我不熟悉Python和Google Apps

我在等待任何一个回复 提前致谢

1 个答案:

答案 0 :(得分:0)

您配置了哪个SMTP服务器?:http://code.google.com/appengine/docs/python/tools/devserver.html#Using_Mail

SMTP主机将成为SMTP服务器(即您的邮件中继)完全限定的域名(不是电子邮件地址,而是网络上的服务器名称)。