gpt4 book ai didi

android - 使用 App inventor 应用程序从谷歌应用程序引擎发送邮件

转载 作者:行者123 更新时间:2023-11-29 14:05:13 24 4
gpt4 key购买 nike

在应用程序发明者中使用 Shival wolfs WolfWebEmail2 通过 Google 应用程序引擎发送邮件,收件人电子邮件中没有任何内容。

需要确认我的代码是否正确。

未在应用引擎上显示任何错误。

运行 webapp 的命令看起来正确吗?

application = webapp.WSGIApplication([('/', MainPage), ('/sendemail', sendemail), ('/attach', attachfile)], debug=True)
def main():
run_wsgi_app(application)

我觉得我有点小键盘大手指综合症。

非常感谢。

好的,齐格。非常感谢。在这里

class sendemail(webapp.RequestHandler):

def process_email(self, data):
outvalue=""
ValidData = False
logging.info("data: %s" %data)
details=data.split("|||")
data = "\"%s\"" %data
if len(details) == 5 or len(details) == 7:
message = mail.EmailMessage()
message.sender = EmailFrom
NewAuthKey = details[0]
EmailTo = details[1]
EmailSubject = details[2]
EmailBody = details[3]
EmailBody = EmailBody.replace("\\t","\t")
if details[4].lower()=="yes" and len(details) == 7:
filename=details[5];
file_id=details[6];
ValidData = True

if ValidData:
if NewAuthKey == AuthKey:
logging.info("Auth Key Valid")
else:
logging.info("Auth Key does not Match")
outvalue = "Auth Key is Invalid"
ValidData = False

if ValidData:
if mail.is_email_valid(EmailTo):
message.to = EmailTo
else:
logging.info("Email Address for TO Address is Invalid")
outvalue = "Email Address for TO Address is Invalid"
ValidData = False

if ValidData:
if len(EmailBody) > 0 and len(EmailSubject) > 0:
message.subject = EmailSubject
message.body = EmailBody
else:
logging.info("Subject or Body was Empty")
outvalue = "Subject or Body was left Empty"
ValidData = False

if ValidData:
if details[4].lower()=="yes":
try:
filedata = db.GqlQuery("SELECT * FROM emailattach WHERE id = :1 LIMIT 1",file_id).get()
if filedata:
message.attachments = [(filename, filedata.blob)]
except Exception, message:
ValidData = False
logging.info("Could not attach file:\n\n "+str(message))
outvalue = "Could not attach file:\n\n "+str(message)

if ValidData:
try:
message.send()
logging.info("Email Sent")
outvalue = "Email Sent"
if details[4].lower()=="yes": ##delete the file once emailed
key = db.GqlQuery("SELECT __key__ FROM emailattach where id = :1", file_id).get()
if key:
db.run_in_transaction(dbSafeDelete,key)

except Exception, message:
logging.info(message)
outvalue = str(message)

self.response.out.write(outvalue)

我希望是这样!对此很陌生。

最佳答案

您遗漏了样板文件的最后一部分:

if __name__ == '__main__':
main()

没有它,将不会处理对每个实例的第一个请求。

关于android - 使用 App inventor 应用程序从谷歌应用程序引擎发送邮件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7407201/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com