One of the most popular uses for the Notify plugin is in web based email forms.
The example below would show a basic form, where a user can input their name and message, and click submit. On submission, the email would be sent.
Using a parameter in the query string, we can set up Hitop so it actually uses the same page for displaying the email form, and sending the email.
<@if name="form_message">
<@requires plugin="notify">
<@notify.email to="myemail@example.com" from="${form_email}"
subject="Email Form Message" message="${form_message}">
<p>Your email has been sent.</p>
<else>
<p>Got something to say to us? Put it in our mail form!</p>
<form action="#" method="post">
<p>Your Email Address:<br>
<input type="text" name="email" size="20"></p>
<p>Your Message:<br>
<textarea name="message" rows="6" cols="20"
wrap="virtual"></textarea></p>
<p><input type="submit" value="Send Message"></p>
</form>
</@if>
The first part is doing a simple check - is a variable in the query string
called message? You'll notice lower down that
message is the name of the textarea box where people
type in their message.
Hitoplive then plugs in the query string variables into the notify command. To get access to the query string variables, they are called in a certain way:
<@get name="form_[variable
name]">
or, if being called within a Hitoplive command
${form_[variable name]}
where [variable name] is the name of the variable in the query
string - so our email variable is called by
${form_email} and message by
${form_message}.
Hitoplive then creates an email using the information passed to
notify.email and sends it to the email address given - in this
case myemail@example.com. Simple.
This may seem the wrong way round as we write the thank you message before
the form in our source code, as below the else command is where
we put our form. This consists in our case of a textarea and an
input tag.
All in all, not very complex!