Velocity Reviews - Computer Hardware Reviews

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

Thread Tools

problems mime::lite

Posts: n/a

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

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){
my $attachement_upload = '/var/www/html/upload/';
$attachement_upload .= $attachement;
Type => 'image/gif',
Path => $attachement_upload,
Filename => 'attachement.gif'
) or die "error attaching image: $!\n";
Reply With Quote
Tad McClellan
Posts: n/a
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 '' )
if ( ! length $attachement )

Tad McClellan SGML consulting Removed) Perl programming
Fort Worth, Texas
Reply With Quote

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