Embperl - building dynamic websites with Perl


Utility Functions
[ << Prev: Error trapping ] [ Content ] [ Next: Performance >> ]



MailFormTo($MailTo, $Subject, $ReturnField)top

Sends the content of the hash %fdat in the order specified by @Z<>ffld to the given $MailTo addressee, with a subject of $Subject. If you specify $ReturnField the value of that formfield will be used as Return-Path. Usually, this will be the field where the user enters his e-mail address in the form.

If you specify the following example code as the action in your form

  <FORM ACTION="x/feedback.htm" METHOD="POST"
        ENCTYPE="application/x-www-form-urlencoded">

The content of the form will be mailed to the given e-mail address.

MailFormTo uses EMBPERL_MAILHOST as SMTP server or localhost if non given.

Example:

 <HTML>
 <HEAD>
 <TITLE>Feedback</TITLE>
 </HEAD>
 <BODY>
        [- MailFormTo('webmaster@domain.xy',
                      'Mail from WWW Form', 'email') -]
        Your data has been successfully sent!
 </BODY>
 </HTML>

This will send an email with all the form fields to webmaster@domain.xy, with the Subject 'Mail from WWW Form' and will set the Return-Path of the mail to the address which was entered in the field with the name 'email'.

NOTE: You must have Net::SMTP (from the libnet package) installed to use this function.



exittop

exit will override the normal Perl exit in every Embperl document. Calling exit will immediately stop any further processing of that file and send the already-done work to the output/browser.

NOTE 1: If you are inside of an Execute, Embperl will only exit this Execute, but the file which called the file containing the exit with Execute will continue. NOTE 2: If you called exit with an argument it exits the whole request e.g. exit (200).

NOTE 3: If you write a module which should work with Embperl under mod_perl, you must use Apache::exit instead of the normal Perl exit (as always when running under mod_perl).


[ << Prev: Error trapping ] [ Content ] [ Next: Performance >> ]


© 1997-2023 Gerald Richter / actevy