in Education by
I wrote a sample code to send email from google app engine in Python. I'm not able to figure out why is it sending out every mail twice? mail.py:- from google.appengine.api import mail mail.send_mail(sender="ALPHA ", to="BETA ", subject="test mail", body=""" Dear BETA, How have you been? Regards, ALPHA """) app.yaml:- application: MyUniqueAppID version: 1 runtime: python api_version: 1 handlers: - url: .* script: mail.py JavaScript questions and answers, JavaScript questions pdf, JavaScript question bank, JavaScript questions and answers pdf, mcq on JavaScript pdf, JavaScript questions and solutions, JavaScript mcq Test , Interview JavaScript questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)

1 Answer

0 votes
by
If that really is your app.yaml, then any request to your app is going to result in a mail being sent. If you visit the site with a web-browser, it will first make a request for /, then probably also make a request for /favicon.ico and potentially other unintended requests. Each resulting in a mail being sent. You should: Make your url route in app.yaml more specific than .* Not just place your code directly in the module scope as you appear to have done for mail.py. Modules can get cached and although this will work, it might not work like that forever, so use the webbapp framework to create a propper application/handler within mail.py

Related questions

0 votes
    I am using Eclipse with Pydev and googleAppengine. I have python 2.7 installed. I am trying to run ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 19, 2022 in Education by JackTerrance
0 votes
    What is the actual difference between Google Compute Engine, App Engine and Container Engine in Google Cloud Compute ... three engines? Select the correct answer from above options...
asked Feb 2, 2022 in Education by JackTerrance
0 votes
    Currently, Google App Engine supports both Python & Java. Java support is less mature. However, Java seems to ... libraries, though. Select the correct answer from above options...
asked Feb 1, 2022 in Education by JackTerrance
0 votes
    I was wondering what the difference between App Engine & Compute Engine are. Can anyone explain the difference to me? Select the correct answer from above options...
asked Feb 1, 2022 in Education by JackTerrance
0 votes
    I am asking this in very general sense. Both from cloud provider and cloud consumer's perspective. Also the ... Server like Biztalk? Select the correct answer from above options...
asked Jan 30, 2022 in Education by JackTerrance
0 votes
    I'm using the following method to send mail from Python using SMTP. Is it the right method to use ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 27, 2022 in Education by JackTerrance
0 votes
    I'm using the following method to send mail from Python using SMTP. Is it the right method to use ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 27, 2022 in Education by JackTerrance
0 votes
    I'm using the following method to send mail from Python using SMTP. Is it the right method to use ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 27, 2022 in Education by JackTerrance
0 votes
    Sending an E-mail is similar to- (A) writing a letter (B) drawing a picture (C) talking on the phone (D) ... package (E) None of these Select the correct answer from above options...
asked Dec 2, 2021 in Education by JackTerrance
0 votes
    I have 2 Google Compute Engine instances and I want to open port 9090 in both the instances. I think we need to ... how can I do that? Select the correct answer from above options...
asked Feb 1, 2022 in Education by JackTerrance
0 votes
    I have an application on GKE that I wish to be available via HTTPS only, so I have gotten a signed ... to the kubernetes cluster? Select the correct answer from above options...
asked Jan 31, 2022 in Education by JackTerrance
0 votes
    What is Google Container Engine?...
asked Oct 2, 2021 in Technology by JackTerrance
0 votes
    How should I handle /_ah/start and /_ah/stop requests? Right now they're just getting 404s. Also, ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked May 7, 2022 in Education by JackTerrance
0 votes
    So I have a file not found problem. I have an engine that works in development mode in the engines test/ ... :Rails::Engine isolate_namespace CcsCms::PublicTheme paths["app/views"]...
asked Apr 7, 2022 in Education by JackTerrance
...