ちょっとメール受信機能がほしかったので、作ってみた。
まずは、app.yamlに下の記述を行う
inbound_services: - mail続いて同じapp.yamlに下の記述を行う
- url: /_ah/mail/.+ script: handle_incoming_email.apphandle_incoming_email.pyファイルに以下の記述を行う
import webapp2 from google.appengine.ext.webapp.mail_handlers import InboundMailHandler class HogeHandler(InboundMailHandler): def receive(self, mail_message): #処理を記述 app = webapp2.WSGIApplication([HogeHandler.mapping()], debug=True)これで
string@appid.appspotmail.comで記述されたメールを受信することができる。
(stringは、任意の文字列、appidは、google app engineのプロジェクト作成時に作ったappid)
0 コメント:
コメントを投稿