Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6122015
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T15:50:59+00:00 2026-05-23T15:50:59+00:00

I wrote a sample code to send email from google app engine in Python.

  • 0

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 <ALPHA@gmail.com>",
        to="BETA <BETA@hotmail.com>",
        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
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T15:51:00+00:00Added an answer on May 23, 2026 at 3:51 pm

    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:

    1. Make your url route in app.yaml more specific than .*
    2. 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
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I wrote a small sample of code in C# to capture selected text from
I use the following code (from Bluetooth Chat sample app) to read the incoming
I am using the sample code from nodejs.org and trying to send the response
i want to send email from my application,how can write code for send email
I'm attempting to write a Python function to send an email to a list
I'm trying make my first python app. I want make simple email sender form.
I wrote visualforce page that you can send email. It works fine in English.
I'm writing an asynchronous server and client with C#. I took sample code from
I am trying to write code to send a simple mail from asp.net page.
I wrote very simple code to send emails. I wish that end users who

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.