Sending Mail from a Web Page

Now that you have a mail function—send_mail()—the rest of sending mail from a Web page is a snap! You just have to design a page and write the CGI to go along with it. A sample email HTML form is shown in Listing 22.3. The form isn't very pretty, but feel free to use your own style to spice it up.

Listing 22.3 HTML Form for Sending Email
 1. <!--assumes a program called /cgi-bin/mailer.cgi exists--> 2. <FORM METHOD=POST ACTION="/cgi-bin/mailer.cgi"> 3. Your address: <INPUT TYPE=text NAME=return_addr><BR> 4. Subject: <INPUT TYPE=text NAME=subject><BR> 5. <BR> 6. Message:<BR> 7. <TEXTAREA NAME=body ROWS=20 COLS=60 WRAP=hard> 8. Type your message here 9. </TEXTAREA> 10. <BR> 11. <INPUT TYPE=SUBMIT VALUE="Send Message"> ...

Get Sams Teach Yourself Perl in 24 Hours now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.