Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to send an e-mail from a Python script that is being run on "Google App Engine"?
    text
    copied!<p>How could I send an e-mail from my Python script that is being run on <a href="http://code.google.com/intl/en/appengine/" rel="nofollow noreferrer">"<strong>Google App Engines</strong>"</a> to one of my mail boxes? </p> <p>I am just a beginner and I have never tried sending a message from a Python script. I have found this script <a href="http://www.yak.net/fqa/84.html" rel="nofollow noreferrer"><strong>(IN THIS TUTORIAL)</strong></a>:<img src="https://i.stack.imgur.com/G8rzi.jpg" alt="alt text"> </p> <p>Here is the same script as a quote:</p> <hr> <pre><code>import sys, smtplib fromaddr = raw_input("From: ") toaddr = string.splitfields(raw_input("To: "), ',') print "Enter message, end with ^D:" msg = '' while 1: line = sys.stdin.readline() if not line: break msg = msg + line # The actual mail send server = smtplib.SMTP('localhost') server.sendmail(fromaddr, toaddrs, msg) server.quit() </code></pre> <hr> <p>but I hardly understand how I could have this script run from "Google App Engine": </p> <p><strong>1)</strong> Firstly, I don't quite understand what e-mail address I need to place right after <strong><em>From:</em></strong> in this line:</p> <hr> <pre><code>fromaddr = raw_input("From: ") </code></pre> <hr> <p>Can I just place here any e-mail address of any e-mail boxes that I have?</p> <p><strong>2)</strong> Secondly, let's say I want to send a message to this e-mail address of mine <em>brilliant@yahoo.com</em> . Then the next line, I guess, must look this way:</p> <hr> <pre><code>toaddr = string.splitfields(raw_input("To: brilliant@yahoo.com"), ',') </code></pre> <hr> <p>Is this right?</p> <p><strong>3)</strong> Thirdly, let's say, the message that I want to send will be this sentence: <em>Cats cannot fly!</em> Then, I guess, the line that starts with <strong><em>msg =</em></strong> must look this way:</p> <hr> <pre><code>msg = 'Cats cannot fly!' </code></pre> <hr> <p>Is this correct?</p> <p><strong>4)</strong> If I upload this script as an application to "GAE", how often will it be sending this message to my mail box? Will it send this message to me only once or it will be sending it to me every second all the time until I delete the application? (This is why I haven't tried uploading this script so far)</p> <p>Thank You all in advance for Your time and patience. </p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload