Hi you appear to be using cgi-lib.pl to parse your input which is outdated, you will find CGI more reliable. Anyway a stepwise approach is in order to debug.

1) Check your sendmail routine works:

my $to = 'me@my_email.com'; my $from = 'nobody@nowhere.com'; my $subject = 'test message'; my $body = 'message body'; sendmail($to,$from,$subject,$body) or err_trap("Sendmail Choked");

Having proven that your sendmail routine works check to see that your script is getting the input you expect, Data::Dumper is a handy way to output the entire %in hash:

use Data::Dumper; $email= $in{'EMAIL'}; $mserv= $in{'ELIST'}; print "Content-type: text/html\n\n<pre>\n"; print Dumper \%in; print '</pre>'; exit;

If that does not reveal the problem then it may be that your ISP's domain (sendmail is using this in the headers) may be on your target mail recipients spam haven list and has been banned.....

One reason that domains get banned is because people (like you) write insecure scripts (like yours). The 'hidden' field for the to address lets me use your CGI to send mail to anyone@anywhere.com with a from address of spammer@someones.open.gateway.com

As it happens I know your sendmail routine works because I spammed myself with a test message simply by typing this into my browser address bar (of course I could have used LWP and sent 1,000,000 messages killing your mail server and flooding my enemies)

http://www.afoto.com/cgi-bin/boo/amail.cgi?ELIST=jfreeman@tassie.net.a +u&EMAIL=nobody@nowhere.com

You must 'hard code' the to address in your script. If you want to deliver to lots of addresses you should store them in a data structure and use 'ELIST' to select the desired address, that way the only available target addresses are yours....

Update

Your mail server is using anonymous as its return path which may well be the problem. Here are the headers from my test spam via your script:

Return-Path: <anonymous@hercules.dns-solutions.net> Received: from hercules.dns-solutions.net (hercules.dns-solutions.net +[209.66.124.56]) by perseus.tassie.net.au (8.12.6/8.12.6/RG2.3) with SMTP id gA60ux +p7000438 for <jfreeman@tassie.net.au>; Wed, 6 Nov 2002 11:57:00 +1100 (EST) Received: (qmail 3141 invoked by uid 441); 6 Nov 2002 00:56:59 -0000 Date: 6 Nov 2002 00:56:59 -0000 Message-ID: <20021106005659.3140.qmail@hercules.dns-solutions.net> To: jfreeman@tassie.net.au From: nobody@nowhere.com Subject: subscribe X-UIDL: Moa!!,#]!!9dU"!0[G!!

cheers

tachyon

s&&rsenoyhcatreve&&&s&n.+t&"$'$`$\"$\&"&ee&&y&srve&&d&&print


In reply to Re: form+subscription+Perl+sendmail = TROLL by tachyon
in thread form+subscription+Perl+sendmail = TROLL by vnomad

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.