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

[MacPerl-WebCGI] Net::SMTP question



Hi :)
I am trying to use Net::SMTP to send mail to someone who fills out a web
form (content depending on what they filled out). It seems to be working
OK except for the one problem that it apparently keeps putting the
recipient's email address under BCC instead of TO, so the recipient sees
something like "undisclosed recipients" in the TO field. The information
that this program will email is somewhat sensitive so it might make the
customer nervous to see "undisclosed recipients" in the To: field and it
might make them think the message has been sent to multiple people.

Below is my code.
Am I doing anything wrong?

Thanks :)
Frances Schuetz


#!perl

use Net::SMTP;


$sender = "someone\@somewhere.edu";
$recipient = "someoneelse\@somewhere.com";
$subj = "this is a test";

$body = <<EOM;
this is the message
EOM

$mailhost = "working SMTP mail host address";

@body = split(/\n/,$body);

$smtp = Net::SMTP->new($mailhost,
        Hello => $mailhost
        );

$smtp->mail($sender);

$smtp->to($recipient);

$smtp->data();
$smtp->datasend("Content-Transfer-Encoding: US-ASCII\n");
$smtp->datasend("Content-Type: text/plain; charset=\"US-ASCII\"\n");
$smtp->datasend("Subject: $subj\n");

$smtp->datasend("\n");

while (@body){
   $text = shift @body;
   $smtp->datasend("$text\n");
}

$smtp->dataend();

$smtp->quit;






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