Problem with email

From: Ning li (ningli2000_at_worldnet.att.net)
Date: 12/27/03


Date: Sat, 27 Dec 2003 06:30:17 GMT

Hi,

   I am trying to send email to multiple recipients using CGI and form. In
the program, I check for the citycodes in the HTML form using subroutine
"check_citycode()". All the form entries will be emailed to different
recipients depending on the city code entered. The problem is, I always get
the message of "No recipient addresses found in the header", though I know I
put the addresses in the perl script.

   Thanks in advance for your help.

   Nick Li

 The code is as the follow:

  #!/usr/local/bin/perl

$mailprog = '/usr/lib/sendmail -i -t';

# Process query string
if( $ENV{'REQUEST_METHOD'} eq "POST" )
{
  read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
}
else
{
  $buffer = $ENV{"QUERY_STRING"};
}

@pairs = split(/&/, $buffer);

foreach $pair (@pairs)
{
  ($name, $value) = split(/=/, $pair);
  $value =~ tr/+/ /;
  $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
  $IN{$name} = $value;
}

$my_citycode = check_citycode();

# Print the page header
print "Content-type: text/html\r\n\r\n";

sub mailComment
{
  open(MAIL,"|$mailprog");

  # The parameter array contains one hash reference. Assign it to a local
variable.
  my ($hashReference) = @_;

  # Iterate over the hash entries and print them out in the order of the
keys
  if ($my_citycode eq "NY")
  {
    foreach $key (sort keys %$hashReference)
    {
      print MAIL "To: jsmith\@hotmail.com\n";
      print MAIL "From: Operations\@tools.com\n";
      print MAIL "Subject: ";
      print MAIL "Information Request\n\n";
      print MAIL "Here is the message\n");
    }
    close (MAIL);
  }

  if ($my_citycode eq "LA")
  {
    foreach $key (sort keys %$hashReference)
    {
      print MAIL "To: ldoe\@hotmail.com\n";
      print MAIL "From: Operations\@tools.com\n";
      print MAIL "Subject: ";
      print MAIL "Information Request\n\n";
      print MAIL "Here is the message\n");
    }
    close (MAIL);
  }
}

sub check_citycode
{
  my ($hashReference) = @_;
  my $citycode = "";

  foreach $key (sort keys %$hashReference)
  {
    if ($key eq "CityCode" && ($$hashReference{$key} eq "NY"))
    {
      $citycode = 'NY';
    }

    if ($key eq "CityCode" && ($$hashReference{$key} eq "LA"))
    {
      $citycode = 'MOPS';
    }
  }
}



Relevant Pages

  • Re: Code example for foreign connector (c#) for Exchange 2007
    ... header fields as the recipients of the message. ... Is that so you can lookup users on the Exchange system as though they ... from coming back to the foreign users when I post it thru the gateway. ...
    (microsoft.public.exchange.development)
  • Re: BCC revealer
    ... The *fields* shown in the UI for your e-mail client have nothing to do ... all recipients specified in the To, Cc, and Bcc *fields* displayed in ... Using this list of recipients, your e-mail client then issues a ... was never copied to a Bcc header in the message, ...
    (microsoft.public.outlook.general)
  • Re: How to send large email
    ... When putting recipients into the Bcc header, ... Spam filters shouldn't be ... Some ISP's limit the recipients-per-message quota to 50, 30, ...
    (microsoft.public.windows.inetexplorer.ie6_outlookexpress)
  • Re: Change Headers That Exchange Uses To Deliver Mail?
    ... >It turns out that our ISP has some kind of SPAM filter that parses the BCC ... If that header remains with the message it's no longer useful since ... So the BCC information is transmitted to the recipients? ... Exchange server if your ISP is acting only as a SMTP proxy. ...
    (microsoft.public.exchange.admin)
  • Re: How to kill spam?
    ... The e-mail client sends a RCPT TO command to the mail server saying who gets the message. ... Multiple RCPT TO commands are sent following by a single DATA command when sending a message to multiple recipients. ... be aware that some good senders may put you in the Bcc field which you cannot test because it was never included in the header portion of their message. ...
    (microsoft.public.windowsxp.newusers)