Zope cannot find the tutorial examples. You should install the tutorial examples before continuing. Choose "Zope Tutorial" from the product add list in the Zope management screen to install the examples.
If you have already installed the tutorial, you can either follow along manually, or reinstall the tutorial examples. Note: make sure that you have cookies turned on in your browser.
What's the first thing you do when you spot Elvis? Report it at the "Elvis Lives" web site! Let's enhance our site to allow visitors to report their Elvis sightings.Click mailhost
Mail Host object to edit it.
Type the name of your mail server in the SMTP Host
field.
Your mail server is typically named mail
. For example,
mail.elvislives.com
. If you don't know the name of your mail
server, ask your system administrator, or check the configuration of
your mail client.
Click the Change
button.
Now Zope can send mail. Next let's edit the template for the Elvis sighting report mail message.
Click the reportAction
document to edit it.
This document is called when a site visitor fills out an Elvis sighting form. This document sends you mail telling you about the sighting. Mail is sent with the <dtml-sendmail> tag which works with the mail host you just configured.
Notice that the to
and the from
line both reference a
property named send_to
.
Click the Properties
tab to edit properties.
Type your email address into the send_to
property field.
Click the Save Changes
button.
Now go to the reportForm
document in the lesson10
folder.
Click the View
tab to view it.
Fill out the Elvis sighting form and submit it.
You should now receive a piece of email describing the Elvis sighting.
Congratulations, you've built a mail form. If you receive
a Zope error, there is a good chance that you haven't set the SMTP
Host
setting on your mail host object correctly.
Summary
After you create a mail host, you can send mail from any Zope document using the <dtml-sendmail> tag.
Mail Hosts allow you to send email.
The <dtml-sendmail> tag sends an email message.
In the next lesson you'll learn how to use Zope to put a database on the web.
Comments on this lesson? Email feedback.