http://www.perlmonks.org?node_id=240943

stu96art has asked for the wisdom of the Perl Monks concerning the following question:

I apologize for asking such a broad question, but I need to write a CGI to take information from my webpage and have it emailed to me. How can I do this? What form does the information get sent in? Any information would help, thanks.

Replies are listed 'Best First'.
Re: html to e-mail
by rozallin (Curate) on Mar 06, 2003 at 17:48 UTC
    By this I am assuming you are talking about using a form to allow users to input data, and that data is sent by email to you when the users hit submit. If so, I would suggest using the CGI.pm module.

    Ovid has a great offsite (and free) Web Programming course that will help you to learn how to implement this, provided you know a little bit of HTML and a little bit of Perl. And if you try a Super Search for CGI.pm and forms, you should come up with quite a lot of nodes that deal with your query.

    Hope it helps, and good luck!

    --
    Rozallin J. Thompson
    The Webmistress who doesn't hesitate to use strict;

Re: html to e-mail
by poj (Abbot) on Mar 06, 2003 at 17:45 UTC
    Take a look at CGI::Application::Mailform which is described as "a reusable and customizable mailform for the web. It is intentionally simple, and provides very few facilities. What it does do is provide an easy-to-use, secure system for taking the contents of a HTML form submission and sending it, via email, to a specified recipient."
    poj
Re: html to e-mail
by sutch (Curate) on Mar 06, 2003 at 17:46 UTC
    I've done this using Mail::Mailer and CGI:

    - create a new Mail::Mailer object
    - call the object's open method, passing a hash with From, To, and Subject
    - print the CGI values to the object

    See the Mail::Mailer docs for more information.

Re: html to e-mail
by thatguy (Parson) on Mar 06, 2003 at 17:47 UTC
    It depends on the format that you encode it with. If you just print the raw data to sendmail it will be a plain text email.

    However, why not take a break from the wheel rewriting and look at the nms formail? It does what you have described and I'm sure you can tweak the look of it to suit.
    -phill