473,395 Members | 1,692 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

How to lunch webpage without using SMTP server?

Hi, Guys,
Is there any other way to use python or mod_python writing a web page?
I mean, not use "form.py/email", no SMTP server.
<form action="form.py/email" method="POST"> ...

Thanks a lot.

Nancy W
Jul 18 '05 #1
21 3333
On 2004-07-21, Nancy <wx*****@hotmail.com> wrote:
Is there any other way to use python or mod_python writing a web page?
I mean, not use "form.py/email", no SMTP server.
<form action="form.py/email" method="POST"> ...


I'm afraid your question make no sense.

SMTP is a mail-transfer protocol. It's got nothing to do with
webpages. Or with lunch. ;)

http://www.catb.org/~esr/faqs/smart-questions.html

--
Grant Edwards grante Yow! How's the wife? Is
at she at home enjoying
visi.com capitalism?
Jul 18 '05 #2
Grant Edwards wrote:
On 2004-07-21, Nancy <wx*****@hotmail.com> wrote:

Is there any other way to use python or mod_python writing a web page?
I mean, not use "form.py/email", no SMTP server.
<form action="form.py/email" method="POST"> ...

I'm afraid your question make no sense.

SMTP is a mail-transfer protocol. It's got nothing to do with
webpages. Or with lunch. ;)

http://www.catb.org/~esr/faqs/smart-questions.html

I think she's trying to say: Is there away to send an email from a web
page without having a SMTP server. I believe a SMTP server (of
sometype) is required somewhere. That said maybe you can use
http://www.hare.demon.co.uk/pysmtp.html
John
Jul 18 '05 #3
On 2004-07-21, John fabiani <jf******@yolo.com> wrote:
On 2004-07-21, Nancy <wx*****@hotmail.com> wrote:
Is there any other way to use python or mod_python writing a web page?
I mean, not use "form.py/email", no SMTP server.
<form action="form.py/email" method="POST"> ...
I'm afraid your question make no sense.

SMTP is a mail-transfer protocol. It's got nothing to do with
webpages. Or with lunch. ;)

http://www.catb.org/~esr/faqs/smart-questions.html


I think she's trying to say: Is there away to send an email
from a web page without having a SMTP server.


I'm afraid I don't quite know what it means to "send an e-mail
from a web page."
http://www.hare.demon.co.uk/pysmtp.html
Hmm, I don't see how you could use that to send an e-mail.
I believe a SMTP server (of sometype) is required somewhere.
That said maybe you can use


If what she's trying to do is send an e-mail from a Python
program (running as a CGI program or ASP handler, or Zope
something-or-other perhaps?), then what she needs is an SMTP
client module like the one implimented by
http://docs.python.org/lib/module-smtplib.html.

To use such an SMTP client, yes, you have to have an SMTP
server to which you can send the e-mail. There's not really
any way around that. SMTP is how e-mail is transferred on the
Internet, and to send an mail you need to connect to an SMTP
server.

You can't send mail with an SMTP server. The direction of
e-mail transfer in SMTP is client --> server. [Unless there
are SMTP extensions that allow bi-directional mail transfers?
I've never seen one in use...]

--
Grant Edwards grante Yow! My uncle Murray
at conquered Egypt in 53
visi.com B.C. And I can prove
it too!!
Jul 18 '05 #4
Nancy wrote:
Hi, Guys,
Is there any other way to use python or mod_python writing a web page?
I mean, not use "form.py/email", no SMTP server.
<form action="form.py/email" method="POST"> ...


So what you want is to be able to send email from a python script
running on your Windows computer, but you don't have access to an SMTP
server.
So you need to run your own SMTP server on your Windows computer. If
you want to do this for a real application, you should get a good SMTP
server (there are some free ones like blat or xmail).

But here are steps to run a crude SMTP server implemented in Python.

Download the two python files from http://www.hare.demon.co.uk/pysmtp.html

Download the zip file for the PyDNS module from
http://pydns.sourceforge.net/

You need to open a command window and install PyDNS. Run "python
setup.py install"

After you have installed PyDNS, then before you can run the SMTP server
you need to find out what DNS server your internet connection is using.
Go to control panel -> network. Click on your network connection, hit
the support tab and then click details to see what DNS servers you are
using. Copy one of them.

Then you can start the SMTP server in a command window. Run "pyspy.py
25 <dns server here>".

If it is running, then run this test script and see if you get the email:

import smtplib

SMTP_SERVER = "localhost"
FROMEMAIL = "wx*****@hotmail.com"
TOEMAIL = "wx*****@hotmail.com"

msg = """From: %s
Subject: test email
To: %s

This is a test message to %s
""" % (FROMEMAIL, TOEMAIL, TOEMAIL)

conn = smtplib.SMTP(SMTP_SERVER)
conn.sendmail(FROMEMAIL, [TOEMAIL], msg)
conn.quit()
Jul 18 '05 #5
You need to open a command window and install PyDNS. Run "python
setup.py install"


And to help make using the command window easier, I'd recommend you
install the CmdHere Windows XP program from here:
http://www.microsoft.com/windowsxp/d...powertoys.mspx

That way, after you unzip pydns into a folder, you can just right-click
on the folder and choose "Open Command Window Here" and run the command.

If "python setup.py install" gives an error that python cannot be found,
try the full path: "\Python23\python.exe setup.py install"
Jul 18 '05 #6
In article <ep********************@comcast.com>,
Doug Holton <in****@spam.here> wrote:
Nancy wrote:

Jul 18 '05 #7
Hi Nancy,

In order to be able to send an e-mail, you need to use either an SMTP
server or have the know-how skill to be able to route the message
yourself. I would HIGHLY recommend that you use an SMTP server.

Here's a code snipplet that you might find helpful:

def sendmessage(toaddr, fromaddr, message):
server = smtplib.SMTP('mail.some-server.com')
server.login("we*******@some-server.com", "mySecretPassword")
server.sendmail(fromaddr, toaddr, message)
server.quit()

You can use this function by doing the following:

sendmessage("by***@somewhere.com", "na***@anotherplace.com", "Let's
have lunch someday via smtp! <grin>")

Hope this helps,

Byron
-----------------------

Nancy wrote:
Hi, Guys,
Is there any other way to use python or mod_python writing a web page?
I mean, not use "form.py/email", no SMTP server.
<form action="form.py/email" method="POST"> ...

Thanks a lot.

Nancy W

Jul 18 '05 #8
Cameron Laird wrote:
In article <ep********************@comcast.com>,
Doug Holton <in****@spam.here> wrote:
So what you want is to be able to send email from a python script
running on your Windows computer, but you don't have access to an SMTP
server.
So you need to run your own SMTP server on your Windows computer. If


.
.
.
No, you don't. If anything, as Grant Edwards points out elsewhere
in this thread you need SMTP *client* code--which is easy enough in
Python.


No, she does need to run her own SMTP server since she doesn't have
access to an existing one. You don't know the history of this thread.
Jul 18 '05 #9
Byron wrote:
Hi Nancy,

In order to be able to send an e-mail, you need to use either an SMTP
server or have the know-how skill to be able to route the message
yourself. I would HIGHLY recommend that you use an SMTP server.

Here's a code snipplet that you might find helpful:

def sendmessage(toaddr, fromaddr, message):
server = smtplib.SMTP('mail.some-server.com')
server.login("we*******@some-server.com", "mySecretPassword")
server.sendmail(fromaddr, toaddr, message)
server.quit()


Again, we've been through all this before. She doesn't have access to
an SMTP server, apparently. She only uses hotmail.
That is why I answered her with instructions on how to run her own SMTP
server just for testing purposes.
Jul 18 '05 #10
Hi Doug,

I agreed with your response. In my reply, I mentioned that she would
have two options, which are to either *get* SMTP access -- or -- to find
some program, plugin, etc that would act as a SMTP server for her.

If she is able to obtain smtp access, then the code I provided below
could be used / modified for it.

Byron
---
Doug Holton wrote:
Byron wrote:
Hi Nancy,

In order to be able to send an e-mail, you need to use either an SMTP
server or have the know-how skill to be able to route the message
yourself. I would HIGHLY recommend that you use an SMTP server.

Here's a code snipplet that you might find helpful:

def sendmessage(toaddr, fromaddr, message):
server = smtplib.SMTP('mail.some-server.com')
server.login("we*******@some-server.com", "mySecretPassword")
server.sendmail(fromaddr, toaddr, message)
server.quit()


Again, we've been through all this before. She doesn't have access to
an SMTP server, apparently. She only uses hotmail.
That is why I answered her with instructions on how to run her own SMTP
server just for testing purposes.

Jul 18 '05 #11
On 2004-07-21, Byron <De*********@netscape.net> wrote:
In order to be able to send an e-mail, you need to use either
an SMTP server or have the know-how skill to be able to route
the message yourself.
Route it to where if not to an SNMP server?
I would HIGHLY recommend that you use an SMTP server.


I simply don't see how you can send mail without using an SMTP
server.

--
Grant Edwards grante Yow! Yow! I'm out of
at work...I could go into
visi.com shock absorbers...or SCUBA
GEAR!!
Jul 18 '05 #12
On 2004-07-21, Byron <De*********@netscape.net> wrote:
I agreed with your response. In my reply, I mentioned that
she would have two options, which are to either *get* SMTP
access -- or -- to find some program, plugin, etc that would
act as a SMTP server for her.
And if she doesn't have access to an SMTP server that will
accept e-mail from her system, what is that local SMTP server
going to do with the e-mail?

True, she can technically "send" e-mail by connecting to an
isolated, local SMTP server, but the mail won't be delivered to
anybody who isn't on her local server. That's OK if she only
wants to send local e-mail.
If she is able to obtain smtp access, then the code I provided below
could be used / modified for it.

Again, we've been through all this before. She doesn't have
access to an SMTP server, apparently.
If that's true, then she can't send e-mail to non-local
addresses -- regardless of whether she's running a local SMTP
server or not.
She only uses hotmail. That is why I answered her with
instructions on how to run her own SMTP server just for
testing purposes.


If it's strictly for testing purposes, and the mail doesn't
need to get delivered, then running a local SMTP server is a
good solution. I must have missed that it was for "just
testing".

--
Grant Edwards grante Yow! Gibble, Gobble, we
at ACCEPT YOU...
visi.com
Jul 18 '05 #13
Hi Grant,

Yes, I agree with you that it would have to be an SMTP server.

What I was referring to is that I found a python script (in the past)
that had the ability to act like a "limited" SMTP server and send e-mail
messages on the net.

Byron
---
Grant Edwards wrote:
On 2004-07-21, Byron <De*********@netscape.net> wrote:

In order to be able to send an e-mail, you need to use either
an SMTP server or have the know-how skill to be able to route
the message yourself.

Route it to where if not to an SNMP server?

I would HIGHLY recommend that you use an SMTP server.

I simply don't see how you can send mail without using an SMTP
server.

Jul 18 '05 #14
Grant Edwards wrote:
I'm afraid I don't quite know what it means to "send an e-mail
from a web page."


If the web page has something like:
<form action="mailto:ab*@example.com">...</form>

You can send an email from that web page.
Quoted from http://htmlhelp.com/reference/html40/forms/form.html:

"A mailto URI (e.g., mailto:li**@htmlhelp.com) is also allowed as an
ACTION, but this is not supported by all browsers. Non-supporting
browsers such as Microsoft Internet Explorer 3.x typically will open a
blank e-mail message when the user submits a mailto form. Even on
supporting browsers, mailto forms are troublesome in that they fail to
provide feedback to the user after the form submission."
Jul 18 '05 #15
On 2004-07-21, Matthew Scott <ne********@goldenspud.com> wrote:
I'm afraid I don't quite know what it means to "send an e-mail
from a web page."


If the web page has something like:
<form action="mailto:ab*@example.com">...</form>

You can send an email from that web page.
Quoted from http://htmlhelp.com/reference/html40/forms/form.html:

"A mailto URI (e.g., mailto:li**@htmlhelp.com) is also allowed as an
ACTION, but this is not supported by all browsers. Non-supporting
browsers such as Microsoft Internet Explorer 3.x typically will open a
blank e-mail message when the user submits a mailto form. Even on
supporting browsers, mailto forms are troublesome in that they fail to
provide feedback to the user after the form submission."


And if the browser impliments that type of URL, it's going to
need access to an SMTP server.

--
Grant Edwards grante Yow! Yow! And then we
at could sit on the hoods of
visi.com cars at stop lights!
Jul 18 '05 #16
Grant Edwards <gr****@visi.com> writes:
On 2004-07-21, Byron <De*********@netscape.net> wrote:
I agreed with your response. In my reply, I mentioned that
she would have two options, which are to either *get* SMTP
access -- or -- to find some program, plugin, etc that would
act as a SMTP server for her.


And if she doesn't have access to an SMTP server that will
accept e-mail from her system, what is that local SMTP server
going to do with the e-mail?


If she's really running a local SMTP "server" (as opposed to just a
dumb forwarder of some sort), then her local server should be
interrogating DNS to locate the appropriate delivery host for the mail
as addressed, and connecting directly there. Now, if you're saying
that the final target SMTP agent/server isn't going to accept e-mail
from her system, she's stuck no matter what she does since there's
just no way for her to send mail to that target address. (Or rather,
then in that case she really does need a remote server running on a
host that hte final delivery server will accept connections from).
Again, we've been through all this before. She doesn't have
access to an SMTP server, apparently.


If that's true, then she can't send e-mail to non-local
addresses -- regardless of whether she's running a local SMTP
server or not.


She can if said local server talks to the final delivery SMTP
agents/servers. They have to be listening or the e-mail addresses
specifying their use for mail delivery won't work at all.

-- David
Jul 18 '05 #17
On 2004-07-21, David Bolen <db**@fitlinxx.com> wrote:
Again, we've been through all this before. She doesn't have
access to an SMTP server, apparently.


If that's true, then she can't send e-mail to non-local
addresses -- regardless of whether she's running a local SMTP
server or not.


She can if said local server talks to the final delivery SMTP
agents/servers. They have to be listening or the e-mail addresses
specifying their use for mail delivery won't work at all.


I assumed that somebody who "doesn't have access to an SMTP"
doesn't have access to any SMTP servers. If "an SMTP server"
means "a local SMTP" or "a relaying SMTP server", then that's a
different story.

--
Grant Edwards grante Yow! PARDON me, am I
at speaking ENGLISH?
visi.com
Jul 18 '05 #18
Grant Edwards <gr****@visi.com> writes:
On 2004-07-21, Byron <De*********@netscape.net> wrote:

(...)
I would HIGHLY recommend that you use an SMTP server.


I simply don't see how you can send mail without using an SMTP
server.


If that includes the final delivery agent that is listening on an SMTP
port to provide delivery to a mailbox on the remote end, I agree. But
to the extent that such a server is being run by a separate
administrative entity, you might not include it in discussions talking
about the client machine. That SMTP server is handling the delivery
end of the mail, not the transmitting.

Typically, when I see discussions of running your own SMTP server,
it's to get the benefits that most servers implement of queueing,
handling DNS information, error bounce messages, and in general robust
management of delivery to the target. But that refers to a local SMTP
server providing such functionality and not the delivery SMTP
agent/server at the destination address. I'm guessing that's what
Bryan may have been referring to. (Run a server locally, and just
hand it messages to deliver).

But you can certainly write SMTP client code that can deliver a
message properly to anyone on the net without needing a local SMTP
server. Heck, you can do it interactively with dig/nslookup and
telnet. Just ask DNS for the MX information properly, resolve the
host(s) down to their IP addresses, and then connect to the delivery
agent there, and transmit the message. It's much easier to have a
smart local SMTP server to take care of the grunge work for you, but
it's certainly doable if you don't have one.

-- David
Jul 18 '05 #19
Hi, Guys,

Please read the article on the following website:
http://www.modpython.org/live/curren...l/tut-pub.html
I am trying to following the example! It looks for your discussion
going to different way.
Whatever, thanks a lot.

Nancy

Doug Holton <in****@spam.here> wrote in message news:<dr********************@comcast.com>...
Cameron Laird wrote:
In article <ep********************@comcast.com>,
Doug Holton <in****@spam.here> wrote:
So what you want is to be able to send email from a python script
running on your Windows computer, but you don't have access to an SMTP
server.
So you need to run your own SMTP server on your Windows computer. If


.
.
.
No, you don't. If anything, as Grant Edwards points out elsewhere
in this thread you need SMTP *client* code--which is easy enough in
Python.


No, she does need to run her own SMTP server since she doesn't have
access to an existing one. You don't know the history of this thread.

Jul 18 '05 #20
Hi, Guys,

Many thanks for all messages! I am new to Python. I wonder whether
many suggestions run in different direction. (Sorry about my English,
may not good enough too.)

I am trying to following the example on
http://www.modpython.org/live/curren...l/tut-pub.html

First, I don't have permission to access a SMTP server.
Second, I don't want to install any SMTP server on my PC.
Third, I want my webpage/form to collect the data provided by users
and let my *.py file to handle these data, such as connect to the
database, select some data, update, etc. that is, something likes
following,
<form action="myfile.py" method="POST" ...>
Then what should I do? How can I achieve that?
The following code is a copy from above website.

<html>
Please provide feedback below:
<p>
<form action="form.py/email" method="POST">

Name: <input type="text" name="name"><br>
Email: <input type="text" name="email"><br>
Comment: <textarea name="comment" rows=4 cols=20></textarea><br>
<input type="submit">

</form>
</html>

Note the action element of the <form> tag points to form.py/email. We
are going to create a file called form.py, like this:
import smtplib

WEBMASTER = "webmaster" # webmaster e-mail
SMTP_SERVER = "localhost" # your SMTP server

def email(req, name, email, comment):

# make sure the user provided all the parameters
if not (name and email and comment):
return "A required parameter is missing, \
please go back and correct the error"

# create the message text
msg = """\
From: %s
Subject: feedback
To: %s

I have the following comment:

%s

Thank You,

%s

""" % (email, WEBMASTER, comment, name)

# send it out
conn = smtplib.SMTP(SMTP_SERVER)
conn.sendmail(email, [WEBMASTER], msg)
conn.quit()

# provide feedback to the user
s = """\
<html>

Dear %s,<br>
Thank You for your kind comments, we
will get back to you shortly.

</html>""" % name

return s

When the user clicks the Submit button, the publisher handler will
load the email function in the form module, passing it the form fields
as keyword arguments. It will also pass the request object as req.

Note that you do not have to have req as one of the arguments if you
do not need it. The publisher handler is smart enough to pass your
function only those arguments that it will accept.
Thanks again.

Nancy
Jul 18 '05 #21
On 2004-07-24, Nancy <wx*****@hotmail.com> wrote:
Hi, Guys,

Please read the article on the following website:
http://www.modpython.org/live/curren...l/tut-pub.html
I am trying to following the example! It looks for your discussion
going to different way.
Maybe you should have posted that bit of information with your
original question. If you post impossibly vague questions,
you can't expect people to correctly guess what you're talking
about.
Whatever,
http://www.catb.org/~esr/faqs/smart-questions.html
thanks a lot.


--
Grant Edwards grante Yow! Do you have exactly
at what I want in a plaid
visi.com poindexter bar bat??
Jul 18 '05 #22

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: James | last post by:
How can I take my form data and send it as an email using my SMTP server located @ my ISP using PHP ? my form has several fields: TO: this is a drop down list FROM: this is a drop down...
1
by: Ken Fine | last post by:
Is it possible to set up server-side mail services such that when someone e-mails to a certain address, the contents attached to that mail are processed and the processed content is returned to the...
1
by: dave | last post by:
hi guys I m trying to execute few lines code tht i have copies from microsoft tech script centre. basically its to send email without using any smtp service. u can find the code snippet from...
2
by: New User | last post by:
Hi, I have a PDF file that I am trying to send as an attachment through a C# program. Even though the PDF file can be opened by itself, sometimes the same file cannot be opened as an...
5
by: trevisc | last post by:
Good afternoon everyone. I'm currently trying to build an automated invoice system that collects dynamic data and automatically sends out invoices. In my test database I have 23 companies that...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.