Hi, I have a script that accepts post data from a form on a website for car part requests. i am having a problem with the e-mail field. sometimes it logs the email address correctly but sometimes it replaces the @ sign with %40. here is the script,

sub email{ $smsreply = 'd:\inetpub\wwwroot\cgi-bin\classads\test'; { local ($buffer, @pairs, $pair, $name, $value, %FORM)}; # Read in text $ENV{'REQUEST_METHOD'} =~ tr/a-z/A-Z/; if ($ENV{'REQUEST_METHOD'} eq "POST") { read(STDIN, $buffer, $ENV{'CON +TENT_LENGTH'}); } else { $buffer = $ENV{'QUERY_STRING'}; } # Split information into name/value pairs @pairs = split(/&/, $buffer); foreach $pair (@pairs) { ($name, $value) = split(/=/, $pair); $value = +~ tr/+/ /; $postFields{ "$name" } = $value; #populatePostFields; $from = $postFields{ "name" }; $msg = $postFields{ "DESC" }; $email = $postFields{ "email" }; $telno = $postFields{ "tel" }; $telnob = $postFields{ "telb" }; $telno = $postFields{ "tel" }; $cc = $postFields{ "CC" }; $vyear = $postFields{ "VYEAR" }; $gears = $postFields{ "gears" }; $make = $postFields{ "make" }; $model = $postFields{ "model" }; $doorno = $postFields{ "doors" }; $fuel = $postFields{ "fuel" }; if ($gears =~ auto){$gears = Automatic} else {$gears = "$gears Speed M +anual"}; $msg =~ s/%../ /g; } open EMAILREQNO, "$emailreqno" ; ($emailref)= <EMAILREQNO>; chomp($emailref); close EMAILREQNO ; $nextemailno = ($emailref+1); $extn = ".dat"; $emailfile = "E$emailref$extn"; $emailtime = "$dayname $monnm $Day $Hour$sep2$Minute$sep2$Second $year +x"; open (EMAIL, ">$emailreqpath/$emailfile"); print EMAIL "EMAIL REQUEST \n"; print EMAIL "$from \n"; print EMAIL "\n"; print EMAIL "$email \n"; print EMAIL "$telno \n"; print EMAIL "$telno \n"; print EMAIL "$vyear $make $model $doorno Door $cc CC $fuel $gears $msg + \n"; print EMAIL "\n"; print EMAIL "\n"; print EMAIL "\n"; print EMAIL "\n"; print EMAIL "\n"; print EMAIL "\n"; print EMAIL "WWW \n"; print EMAIL "$emailtime\n"; print EMAIL "EMAIL Request \n"; print EMAIL "Email Requests \n"; print EMAIL "WWW \n"; print EMAIL "\n"; print EMAIL "EMAIL \n"; close EMAIL; &oops('cannot change email ref number') unless (open(EMAILB, ">$emailr +eqno")); print EMAILB "$nextemailno"; close EMAILB; open REQORDER, "$reqordernum" ; ($reqorder)= <REQORDER>; chomp($reqorder); close REQORDER ; $nextreqorderno = ($reqorder+1); &oops('cannot create Request book entry') unless (open(NEWITEMA, ">$re +qorderpath/$reqorder")); print NEWITEMA "E$emailref\n"; close NEWITEMA; &oops('cannot change req number order') unless (open(REQNUMORDER, ">$r +eqordernum")); print REQNUMORDER "$nextreqorderno"; close REQORDERNUM; print "Content-type: text/html\n\n"; print <<"EOF"; <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http:/ +/www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Untitled Document</title> <style type="text/css"> <!-- .style1 { font-size: 36px; color: #FF0000; } .style2 {font-size: 24px} .style3 {font-size: 36px} .style4 {color: #FF0000} --> </style> </head> <body> <table width=700><TR><TD> <div align="center"> <p class="style1">Thank you for your enquiry.</p> <p class="style2">This has been logged on our system. we will get ba +ck to you shortly.</p> <p class="style2">Your Reference number is <span class="style4">E$em +ailref</span> please make a note of this.</p> <p class="style2">You will need to quote this should you need to con +tact us about your enquiry.</p> <p class="style2">Our telephone number for all enquiries is</p> <p class="style1"> 08454084000</p> </div> </TD></TR></table> </body> </html> EOF }

Everything else works perfectly just sometimes i get this e-mail problem. Any Help would be appreciated. Thanks Michael

In reply to Email Address in Post Replies, by dmsparts

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.