Gossamer Forum
Home : Products : DBMan : Customization :

CGI WRAPPED SENDMAIL

Quote Reply
CGI WRAPPED SENDMAIL
After contacting my ISP about Sendmail they told me it was available but it was wrapped then they told me where to find the following programme which they call a sample file to demonstrate the wrapped sendmail. I cannot for the life of me work out how this works. My Isp know absolutely nothing which is pretty poor considering they r one of the biggest telecoms companies in the world. Does anybody on here know how I would use this code with dbman to send emails ? See code Below:-

#! /usr/local/bin/perl

# ident "@(#)wrapper/mailtest.pl, SYM3-wrapper, SYM3:WRAPPER:1, 7 1.1 00/03/13"

use sendmail;

$script = "mailtest.pl";

$|=1;

print "Content-type: text/html\n\n";

$input = <STDIN>;

foreach $tuple (split( /&/, $input ) ) {

my $name;

( $name, $_ ) = split( /=/, $tuple );

tr/+/ /;

s/%([a-fA-F0-9][a-fA-F0-9])/pack('C', hex($1))/eg;

tr/\n\t\f / /s; # compress white space but preserve CRs

s/ ?\r ?/\r/go; # get rid of white space adjacent to CRs

s/^\s//o; # remove leading white space

s/\s$//o; # remove trailing white space

$form{$name} = $_;

}

if ( $ENV{ 'QUERY_STRING' } !~ /action=Send/ ) {

&displayForm("<i>No Result To Display </i>");

exit;

}

$sender = $form{'sender'};

$recipient = $form{'recipient'};

$subject = $form{'subject'};

$message = $form{'message'};

$result = sendmail( $sender, $recipient, $subject, $message);

&displayForm( "<i>Sendmail returned $result</i>" );

exit;

sub displayForm {

local ($text) = @_;

print "<html><head><title>BT Connect Mail Form</title></head>\n";

print "<BODY BGCOLOR=\"#FFFFFF\" TEXT=\"#000000\">\n";

print "<TABLE CELLSPACING=0 CELLPADDING=0 BORDER=0>\n<TR>";

print "<TD align=center colspan=2>\n";

print "<font size=+1><b>Send a message</b></font><br>\n";

print "<i>$text</i>";

print "</TD></TR><TR>\n";

print "<form method=post action=$script?action=Send>\n";

print "<TD align=center width=90>\n";

print "From</TD><TD align=center><input type=text name=sender size=31>\n";

print "</TD></TR><TR>\n";

print "<TD align=center width=90>\n";

print "Mail To File</TD><TD align=center><input type=text name=recipient size=31>\n";

print "</TD></TR><TR>\n";

print "<TD align=center width=90>\n";

print "Subject</TD><TD align=center><input type=text name=subject size=31>\n";

print "</TD></TR><TR>\n";

print "<TD align=center colspan=2>\n";

print "Message<br>\n<textarea rows=6 cols=40 name=message text=data></textarea></br>\n";

print "<input type=submit value=Send>\n";

print "<input type=reset>\n";

print "</TD></TR></TABLE>\n";

print "</body></html>\n";

}

Subject Author Views Date
Thread CGI WRAPPED SENDMAIL jamesamorris 3059 Jan 17, 2002, 11:55 AM
Post Re: [jamesamorris] CGI WRAPPED SENDMAIL
Soil 2979 Jan 17, 2002, 2:53 PM
Thread Re: [jamesamorris] CGI WRAPPED SENDMAIL
benone 2897 Nov 10, 2003, 4:11 AM
Post Re: [benone] CGI WRAPPED SENDMAIL
LoisC 2888 Nov 10, 2003, 9:46 PM