Previous Chapter | Next Chapter | Up | Next Section | Contents

Sending Mail: the sendmail tag


The sendmail tag is used to send an electronic message using the Simple Mail Transport Protocol (SMPT). Unlike other DTML tags, the sendmail tag does not cause any text to be included in output. Figure See A sample document that uses the sendmail tag shows a DTML document, named SendFeedback , which uses the sendmail tag to send information collected in a feedback form (figure See A feedback form that collects a subject and body from a user and submits them to the SendFeedback document shown in figure 14.). The sendmail tag requires numerous pieces of information that are specified by sendmail tag attributes, shown in Table 27. At minimum, either a Zope MailHost object must be specified, or an SMTP host address must be specified using an smtphost attribute. The recipients, sender, and subject information are required, but they may be provided either as sendmail tag attributes, or using "header" lines16 at the beginning of the message (figure See A sample document that uses the sendmail tag).

A sample document that uses the sendmail tag

<!--#var standard_html_header-->

<!--#sendmail smtphost="gator.digicool.com"-->
To: Product Support <<!--#var support-->>
From: Web Feedback Form <<!--#var feedback-->>
Subject: <!--#var subject-->

<!--#var body-->
<!--#/sendmail-->

Thank you for your input!

<!--#var standard_html_footer-->

A feedback form that collects a subject and body from a user and submits them to the SendFeedback document shown in figure See A sample document that uses the sendmail tag.

<!--#var standard_html_header-->

<H2>We want your input!</H2>

<form action=SendFeedback>
Subject: <input type=text name=subject size=40>
<br>
<textarea name=body rows=10 cols=50>
</textarea><br>
<input type=submit value="Send Feedback">
</form>

<!--#var standard_html_footer-->

sendmail tag attributes

Name

Description

mailhost

A Zope MailHost object that manages Simple Mail Transport Protocol (SMTP) and port information. This attribute is not used if the smtphost attribute is used.

smtphost

The address of a SMTP server. Mail will be delivered to this server, which will do most of the work of sending mail. This attribute is not used of the smtphost attribute is used.

port

If the smtphost attribute is used, then the port attribute is used to specify a port number to connect to. If not specified, then port 25 will be used.

mailto

A recipient address or a list of recipient addresses separated by commas.

mailfrom

A sender address.

subject

The subject of the message.

The text following the sendmail tag can and usually does use DTML tags to include data from input forms and Zope objects. In the S endFeedback example in figure See A sample document that uses the sendmail tag, the variables support and feedback are supplied from Folder properties and the variables subject and body are supplied from the FeedbackForm Document shown in figure See A feedback form that collects a subject and body from a user and submits them to the SendFeedback document shown in figure 14..

Previous Chapter | Next Chapter | Up | Next Section | Contents