[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl-WebCGI] script for sending e-mail using cgi.pm



On Wed, 24 May 2000, Democco Atcher wrote:

> does anyone know where I can get a script that e-mails form data using cgi.pm
> i've seen how to do this using the old cgi-lib, but am using cgi.pm and wanted to use a script that uses this module

######################
#!/usr/bin/perl

my $to = 'chr@solvare.se';
my $subj = 'Från formuläret';

my $txt = '';

use CGI;

my $query = new CGI;

if (@names = $query->param) {

    foreach (@names) {
        next if /^submit$/;
        $txt .= "$_: ";
        $txt .= $query->param($_);
        $txt .= "\n";
    }

    open EMAIL,"|/usr/sbin/sendmail -oi -t" or die "Unable to fork
sendmail";
    print EMAIL "To: $to\nSubject: $subj\n\n$txt";
    close EMAIL;

    print $query->redirect('http://www.ynot.nu/uNus/tack.html');
}
######################

Can be modified to use Net::SMTP if one wants to avoid sendmail calls

                   0
Christian          ^
__________________/|\____________________________________________
                 / | \ http://www.solvare.se/individer/christian/



==== Want to unsubscribe from this list?
==== Send mail with body "unsubscribe" to macperl-webcgi-request@macperl.org