Python在按钮点击时通过Google App Engine发送邮件

1 投票
1 回答
992 浏览
提问于 2025-04-18 18:06

烦恼:我在很多网站上搜索过,但还是找不到答案。

信息:我对Python一无所知。

我想要编写的代码:我想在HTML网页上点击按钮时发送邮件。这个邮件不应该打开用户的邮件客户端,就像HTML中的'mailto'那样,而是直接发送给我。这个网页应用是通过Google App Engine托管的(网址类似于 www.example.appspot.com)。我还想把文本框和单选框中的值一起发送到收件人的邮箱。

HTML表单:

<form method="post" id="rsvpForm" action="">
<div class="row half">
    <div class="6u">
        <input type="text" name="name" id="name" placeholder="Name" />
    </div>
    <div class="6u">
        <input type="text" name="email" id="email" placeholder="Email" />
    </div>
</div>
<br/>
<div>
    <div class="12u">
        <span>Radio grp 1</span>
    </div>
</div>
<div class="row half">
    <div class="12u">
        <input type="radio" name="attendance" value="Options">Options<br>
    </div>
</div>
<br/>
<div class="row half">
    <div class="12u">
        <textarea name="message" id="message" placeholder="Message or wishes" rows="3">
        </textarea>
    </div>
</div>
<div class="row half">
    <div class="12u">
        <ul class="actions">
            <li><input type="submit" class="style1" value="Send" id="sendMessage"/>
            </li>
            <li><input type="reset" class="style2" value="Reset" /></li>
        </ul>
    </div>
</div>

参考资料:我用这个网站来托管我的网站

http://www.labnol.org/internet/host-website-on-google-app-engine/18801/

请帮帮我。我不想使用PHP。

1 个回答

2

从GAE Python发送电子邮件非常简单,但你只发了HTML代码,你是否有一个Python处理程序来完成这个?如果没有,我建议你学习并测试谷歌提供的所有这些教程:https://developers.google.com/appengine/docs/python/gettingstartedpython27/introduction

这是一个从GAE Python发送电子邮件的示例:https://developers.google.com/appengine/docs/python/mail/?hl=fr#Python_Sending_mail_in_Python

撰写回答