J
john.swilting
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;
}
}
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;
}
}