develooper Front page | perl.beginners | Postings from February 2002


Thread Next
Nikola Janceski
February 12, 2002 13:44
Message ID:
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 => ''}) || die "$sender -- $Mail::Sender::Error\n";

$sender->OpenMultipart({from => $FORM{'from'}, cc => $FORM{'cc'},
                       subject => $FORM{'subject'} } ) || die


foreach $file (split(/\s+/, $FORM{'files'})){
	if ($file =~ /.*\.tar(\.Z)?$/i) { $type = "gzip"; $app =
	if ($file =~ /.*\.zip$/i) { $type = "zip"; $app = "application";}
	if ($file =~ /.*\.html$/i) { $type = "html"; $app = "text";}
	if ($file =~ /.*\.doc$/i) { $type = "word"; $app = "application";}
		ctype => "$app/$type",
		encoding => 'Base64',
		file => "$file"
		}) || die "$Mail::Sender::Error\n";

$sender->Close() || die "$Mail::Sender::Error\n";


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/ 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};


Nikola Janceski
Summit Systems, Inc.

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 Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About