ImportError:appengine中的“没有名为mail的模块”

时间:2014-02-19 13:09:55

标签: python google-app-engine email

我是appengine的新手。我正在尝试生成一个Flask Python来发送电子邮件,但我得到以下跟踪:

Traceback (most recent call last):
  File "/base/data/home/runtimes/python27/python27_lib/versions/1/google/appengine/runtime/wsgi.py", line 239, in Handle
    handler = _config_handle.add_wsgi_middleware(self._LoadHandler())
  File "/base/data/home/runtimes/python27/python27_lib/versions/1/google/appengine/runtime/wsgi.py", line 298, in _LoadHandler
    handler, path, err = LoadObject(self._handler)
  File "/base/data/home/runtimes/python27/python27_lib/versions/1/google/appengine/runtime/wsgi.py", line 84, in LoadObject
    obj = __import__(path[0])
ImportError: No module named mail

代码非常简单,基本上是两个谷歌示例之间的混合:

from google.appengine.api import mail
'''
Created on 19/02/2014

@author: Juan Carlos Hdez.

'''

# Import the Flask Framework
from flask import Flask
app = Flask(__name__)

#sending the email


@app.route('/', methods=['GET', 'POST'])
def send():
    mail.send_mail(sender="mailOfappengineacount@gmail.com",
                  to="admin@example.com",
                  subject="Your account has been approved",
                  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
    """)

@app.errorhandler(404)
def page_not_found(e):
    """Return a custom 404 error."""
    return 'Sorry, Nothing at this URL.', 404

感谢。

0 个答案:

没有答案