Front page | perl.beginners |
Postings from February 2002
Mail::Sender
Thread Next
From:
Nikola Janceski
Date:
February 12, 2002 13:44
Subject:
Mail::Sender
Message ID:
1449413DA482D311B67000508B5A12F50592DD36@nyexchange01.summithq.com
Okay I am at a loss here...
I am using Mail::Sender to generate e-mails from a cgi page.
I am successful with genereating it using a regular script run from a
command line.
But when I put the code into my cgi it gives me this stupid error, (I
upgraded the module to the latest).
The code is almost an exact copy of one of the examples in the
documentation. And funny how it dies in the module and not in my script.
Here is the code I am using:
[snip all the checking and crap]
use Mail::Sender;
ref($sender = new Mail::Sender
{smtp => 'mailhost.xxxx.com'}) || die "$sender -- $Mail::Sender::Error\n";
$sender->OpenMultipart({from => $FORM{'from'}, cc => $FORM{'cc'},
subject => $FORM{'subject'} } ) || die
"$Mail::Sender::Error\n";
$sender->Body();
$sender->SendEx("$FORM{'mess'}");
foreach $file (split(/\s+/, $FORM{'files'})){
if ($file =~ /.*\.tar(\.Z)?$/i) { $type = "gzip"; $app =
"application";}
if ($file =~ /.*\.zip$/i) { $type = "zip"; $app = "application";}
if ($file =~ /.*\.html$/i) { $type = "html"; $app = "text";}
if ($file =~ /.*\.doc$/i) { $type = "word"; $app = "application";}
$sender->SendFile({
ctype => "$app/$type",
encoding => 'Base64',
file => "$file"
}) || die "$Mail::Sender::Error\n";
}
$sender->Close() || die "$Mail::Sender::Error\n";
__END__
The ERROR I receive is:
can't use an undefined value as a symbol reference at
/..../perl-5.6.1-unix/lib/perl5/site_perl/5.6.1/mail/sender.pm line 1229.
Any clues as to what might be my problem?
$FORM contains true values foreach key or "";
here is the code from the module:
sub EndPart {
my $self = shift;
# return unless $self->{part};
my $s = $self->{'socket'};
if ($self->{buffer}) {
my $code = $self->{code};
print $s (&$code($self->{buffer}));
delete $self->{buffer};
}
print $s "\r\n--",$self->{'boundary'},"\r\n"; ######### line 1229
undef $self->{part};
1;
}
ANY HELP IS MUCH APPRECIATED <8^s
Nikola Janceski
Summit Systems, Inc.
212-896-3400
To find out a girl's faults, praise her to her girl friends.
-- Benjamin Franklin
----------------------------------------------------------------------------
--------------------
The views and opinions expressed in this email message are the sender's
own, and do not necessarily represent the views and opinions of Summit
Systems Inc.
Thread Next
-
Mail::Sender
by Nikola Janceski