if condition error

D

David Sudjiman

Hi,

I'm using this perl script to get the information from a form and send
it through email. The problem is when I do an email address validation.
it seems it does not want to match it. For example, i give the real
(e-mail address removed) for mail_from it works. But if I give 123, the web page
turns error 500 internal error. Please advice.



#!/usr/bin/perl
use strict;
use warnings;

use CGI;
use CGI::pretty qw:)all);

my $cgi = new CGI;

my $rcpt_to = "abc\@abc\.com";
my $mail_from = $cgi -> param('email');
my $subject = $cgi -> param('milis');
my $data = $cgi -> param('keterangan');
my $request_method = $ENV{'REQUEST_METHOD'};
my $remote_address = $ENV{'REMOTE_ADDR'};
my $mail = "/usr/bin/mail -s $subject $rcpt_to";

if (
# $mail_from =~ /(@.*@)|(\.\.)|(@\.)|(\.@)|(^\.)/ ||
# $mail_from !~ /^.+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z0-9]+)(\]?)$/)
$mail_from == '123'
) {
print "Email Error";
}
else {
print $cgi -> header();
print $cgi -> start_html("Title HERE!");
print $cgi -> param('email'), "<br/>";
print $cgi -> param('milis'), "<br/>";
print $cgi -> param('keterangan'), "<br/>";
print $cgi -> end_html();

open (MAIL, "| $mail");
print MAIL "$remote_address \n $data\n\n";
close (MAIL);
}
 
J

Jürgen Exner

David Sudjiman wrote:
[...]
validation. it seems it does not want to match it. For example, i
give the real (e-mail address removed) for mail_from it works. But if I give 123,
the web page turns error 500 internal error. Please advice.

Did you check "perldoc -q 500"?

jue
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,764
Messages
2,569,564
Members
45,040
Latest member
papereejit

Latest Threads

Top