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

RE: Mail::Sender

Thread Previous | Thread Next
From:
Nikola Janceski
Date:
February 12, 2002 14:18
Subject:
RE: Mail::Sender
Message ID:
1449413DA482D311B67000508B5A12F50592DD37@nyexchange01.summithq.com
It's a bug... I forgot the 'to' and it just dies at the line
$sender->Body();

I am submitting a bug report. It should handle an e-mail without a to and
only a cc, or bcc.


-----Original Message-----
From: Nikola Janceski [mailto:nikola_janceski@summithq.com]
Sent: Tuesday, February 12, 2002 4:45 PM
To: 'beginners@perl.org'
Subject: Mail::Sender


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.


-- 
To unsubscribe, e-mail: beginners-unsubscribe@perl.org
For additional commands, e-mail: beginners-help@perl.org

----------------------------------------------------------------------------
--------------------
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 Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About