Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > problems mime::lite

Reply
Thread Tools

problems mime::lite

 
 
john.swilting
Guest
Posts: n/a
 
      02-12-2007

a small end of code
a small end of code contains die
but how to check that the email to pass in parameter is valid

sub SEND_MAIL{
my($attachement,$nom,$prenom,$mail,$body) = @_;

my $message_body .= $nom;
$message_body .= "\n";
$message_body .= $prenom;
$message_body .= "\n";
$message_body .= $body;

my $mime_msg = MIME::Lite->new(
From => $from_adress,
To => $mail,
Subject => 'contact',
Type => 'TEXT',
Data => $message_body,
) or die "error creating MIME body: $!\n";
if($attachement eq undef){
$mime_msg->send;
}else{
my $attachement_upload = '/var/www/html/upload/';
$attachement_upload .= $attachement;
$mime_msg->attach(
Type => 'image/gif',
Path => $attachement_upload,
Filename => 'attachement.gif'
) or die "error attaching image: $!\n";
$mime_msg->send;
}
}
 
Reply With Quote
 
 
 
 
Tad McClellan
Guest
Posts: n/a
 
      02-12-2007
john.swilting <(E-Mail Removed)> wrote:

> if($attachement eq undef){



That probably does not do what you want.

If you want to test for undef, then:

if ( ! defined $attachement ) {

If you want to test for empty string then:

if ( $attachement eq '' )
or
if ( ! length $attachement )


--
Tad McClellan SGML consulting
http://www.velocityreviews.com/forums/(E-Mail Removed) Perl programming
Fort Worth, Texas
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Saving the web, charset problems and symbols problems Sak Na rede Ruby 0 01-30-2009 05:05 AM
Problems, problems for newbie Shelly ASP .Net 1 09-03-2007 02:10 AM
Problems compiling simple C++ code (also problems with std::string) Susan Baker C++ 2 06-26-2005 01:43 AM
Re: sound problems and modem problems Harold Potter Computer Support 5 12-04-2003 04:12 PM



Advertisments