views:

589

answers:

1

My Google app engine application needs to send out email(what ever we get the data from screen). On development server i specify my smtp configuration (host,port,user,password) while starting the server. then I am running my application in that form after I submitted the data its showing error as

**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**

its telling that SMTPServerDisconnected, please run connect() first following code I am using

mail.send_mail(sender="[email protected]", to="[email protected]", subject="Test Message", body=""" Dear Albert:

          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
          """)

please tell me what is the wrong in this code i am new to Python and Google Apps

I am waiting for any one reply Thanks in advance

A: 

Which SMTP server are you configured to use?: http://code.google.com/appengine/docs/python/tools/devserver.html#Using_Mail

SMTP Host is going to be the SMTP server's (i.e. your mail relay) fully qualified domain name (not an email address, but a server name on the network).

Cade Roux
I am taken sample code of same what it mentioned here (http://code.google.com/appengine/docs/python/tools/devserver.html#Using_Mail)specifically I am not configured any SMTP server in my local, its taking the path from Python..
SKSK
Er, using 'smtp.example.com' as in that example is obviously not going to work. What's your exact command line?
Nick Johnson
HiJohnson... for smtp_host mail id I given my email id, not given 'smtp.example.com' this is what my command line dev_appserver.py [email protected] --smtp_port=25 --smtp_user=aaaa --smtp_password=bbbb tempwhere temp is my applicationtell me from where I can get host,port, username,password details?
SKSK
--smtp_host needs to be the hostname of a mail server to send email to, not an email address.
Nick Johnson