1

さて、GAE ボイラープレートのリソースが不足していることに不満を感じています。特に、ディレクトリ構造に関しては少し複雑なので、ここに来ました。

contact.htmlとにかく、定型文で提供されたテンプレートから適応させたこの連絡フォームがあります。訪問者がユーザー登録を利用できるようにすることには興味がありません。 Full nameEmail address、およびを使用した非常に単純な連絡フォームが必要なだけですMessage。私が知る限り、ボイラープレートからコードを変更していないため、フォーム自体は機能しています。

    <form id="form_contact" action="{{ url|safe }}" method="post" class="well form-horizontal">
        <fieldset>
            <input type="hidden" name="exception" value="{{ exception|e }}">
            <input type="hidden" name="_csrf_token" value="{{ csrf_token() }}">
            {{ macros.field(form.name, label=_("Name"), placeholder=_("Enter your")+" "+_("Name"), class="input-xlarge focused required") }}
            {{ macros.field(form.email, label=_("Email"), placeholder=_("Enter your")+" "+_("Email"), class="input-xlarge focused required email", type="email") }}
            {{ macros.field(form.message, label=_("Message"), class="input-xlarge required", cols="40", rows="8") }}
            <div class="form-actions">
                <button type="submit" class="btn btn-primary">{% trans %}Send Message{% endtrans %}</button>
            </div>
        </fieldset>
    </form>

私が抱えている問題は、私が望んでいる電子メールアドレスに電子メールを送信できないことです。送信できるように変更するように指示できる唯一のファイルd*******@gmail.comconfig.pyファイルであり、これを変更してみました:

# contact page email settings
'contact_sender': "l*******@gmail.com",
'contact_recipient': "d*******@gmail.com",

line 24終わるline 26が運がない。変更することになっている別の構成ファイルはありますか? ところで、config.py私が変更したファイルの正確なディレクトリはC:\Users\*****\Desktop\Projects\******\boilerplate\config.py

4

1 に答える 1

2

ログは何と言っていますか?

GAE では、メールの送信者は、appengine コンソールに登録されている管理者か、ログインしている Google ユーザーのいずれかである必要があります。したがって、これらの条件のいずれにも当てはまらない場合、メールは送信されません。

これが私がそれを行う方法であり、私にとってはうまくいきます(appengine管理コンソールで管理者として電子メールアドレスを登録した後):

from google.appengine.api import mail

 ...

 message = mail.EmailMessage(sender='Kool Business <info@koolbusiness.com>', subject=article.title)
            message.body = """
            Hello!<br>Now your ad <a href="http://www.koolbusiness.com/vi/%d.html">%s</a> has been out for a week. If you already have sold your product you can remove your ad.<br><br>Some advice to promote your ad:<br>Change + Renew the ad and it will be on top of the list. You can also change text and price.<br>Change the ad if you only want to lower the price or change the ad text<br>Renew so that the ad will be on top if the list. <br><br>Best regards,<br>Koolbusiness.com
            """  % (article.key().id(),article.title)
            message.html = """
            <html><head></head><body>
            Hello!<br>Now your article <a href="http://www.koolbusiness.com/vi/%d.html">%s</a> has been out for a week. If you already have sold your product you can remove your ad.<br><br>Some advice to promote your article:<br>Change + Renew the article and it will be on top of the list. You can also change text and price.<br>Change the article if you only want to lower the price or change the ad text<br>Renew so that the ad will be on top if the list. <br><br>Best regards,<br>Koolbusiness.com
            </body></html>
            """  % (article.key().id(),ad.title)
            message.to=article.email
            message.send()
于 2013-09-15T23:53:37.417 に答える