Page 1 of 3

The submitted form- enlarge text in received email? UGLY

Posted: Fri Sep 18, 2009 5:50 pm
by ducatigirl67
After the form is submitted and it arrives in the email, it is ugly.
Is there a way to pretty it up, and make the font larger?
Instead of this...

I am a php gumby, know basically nothing.

ar_file: /www/formmail_path/autoresponder.txt
ar_subject: Thank you for your interest!
name: ducatigirl
phone_no: 0000000000
email: phpgumby@yahoo.com.au
hire: I am interested in hiring
I_am_interested_in_hiring: bull and princess
I_am_interested_in_purchasing:
I_want_to_book_it_for_this_date: january 21 2010
Enquiry: hello does this work??????


And here is the code

Code: Select all

<?
/*
##############################################################################
# PLEASE DO NOT REMOVE THIS HEADER!!!
#
# COPYRIGHT NOTICE
#
# FormMail.php v5.0
# Copyright 2000-2004 Ai Graphics and Joe Lumbroso (c) All rights reserved.
# Created 07/06/2000   Last Modified 10/28/2003
# Joseph Lumbroso, http://www.aigraphics.com, http://www.dtheatre.com
#                  http://www.dtheatre.com/scripts/
##############################################################################
#
# This cannot and will not be inforced but I would appreciate a link back
# to any of these sites:
# http://www.dtheatre.com
# http://www.aigraphics.com
# http://www.dtheatre.com/scripts/
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
# OTHER DEALINGS IN THE SOFTWARE.
#
##############################################################################
*/
 
// for ultimate security, use this instead of using the form
$recipient = "bouncybounce@optusnet.com.au"; // bouncybounce@optusnet.com.au
 
// bcc emails (separate multiples with commas (,))
$bcc = "";
 
// referers.. domains/ips that you will allow forms to
// reside on.
$referers = array ('somedomain.com','www.somedomain.com','121.0.0.111');
 
// field / value seperator
define("SEPARATOR", ($separator)?$separator:": ");
 
// content newline
define("NEWLINE", ($newline)?$newline:"\n");
 
// formmail version (for debugging mostly)
define("VERSION", "5.0");
 
 
// our mighty error function..
function print_error($reason,$type = 0) {
   build_body($title, $bgcolor, $text_color, $link_color, $vlink_color, $alink_color, $style_sheet);
   // for missing required data
   if ($type == "missing") {
      if ($missing_field_redirect) {
         header("Location: $missing_field_redirect?error=$reason");
         exit;
      } else {
      ?>
      The form was not submitted for the following reasons:<p>
      <ul><?
      echo $reason."\n";
      ?></ul>
      Please use your browser's back button to return to the form and try again.<?
      }
   } else { // every other error
      ?>
      The form was not submitted because of the following reasons:
      <?
   }
   echo "<br>\n";
   exit;
}
 
 
 
// This function takes the sorts, excludes certain keys and 
// makes a pretty content string.
function parse_form($array, $sort = "") {
   // build reserved keyword array
   $reserved_keys[] = "MAX_FILE_SIZE";
   $reserved_keys[] = "required";
   $reserved_keys[] = "redirect";
   $reserved_keys[] = "require";
   $reserved_keys[] = "path_to_file";
   $reserved_keys[] = "recipient";
   $reserved_keys[] = "subject";
   $reserved_keys[] = "sort";
   $reserved_keys[] = "style_sheet";
   $reserved_keys[] = "bgcolor";
   $reserved_keys[] = "text_color";
   $reserved_keys[] = "link_color";
   $reserved_keys[] = "vlink_color";
   $reserved_keys[] = "alink_color";
   $reserved_keys[] = "title";
   $reserved_keys[] = "missing_fields_redirect";
   $reserved_keys[] = "env_report";
   $reserved_keys[] = "submit";
   if (count($array)) {
      if (is_array($sort)) {
         foreach ($sort as $field) {
            $reserved_violation = 0;
            for ($ri=0; $ri<count($reserved_keys); $ri++)
               if ($array[$field] == $reserved_keys[$ri]) $reserved_violation = 1;
 
            if ($reserved_violation != 1) {
               if (is_array($array[$field])) {
                  for ($z=0;$z<count($array[$field]);$z++)
                     $content .= $field.SEPARATOR.$array[$field][$z].NEWLINE;
               } else
                  $content .= $field.SEPARATOR.$array[$field].NEWLINE;
            }
         }
      }
      while (list($key, $val) = each($array)) {
         $reserved_violation = 0;
         for ($ri=0; $ri<count($reserved_keys); $ri++)
            if ($key == $reserved_keys[$ri]) $reserved_violation = 1;
 
         for ($ri=0; $ri<count($sort); $ri++)
            if ($key == $sort[$ri]) $reserved_violation = 1;
 
         // prepare content
         if ($reserved_violation != 1) {
            if (is_array($val)) {
               for ($z=0;$z<count($val);$z++)
                  $content .= $key.SEPARATOR.$val[$z].NEWLINE;
            } else
               $content .= $key.SEPARATOR.$val.NEWLINE;
         }
      }
   }
   return $content;
}
 
// mail the content we figure out in the following steps
function mail_it($content, $subject, $email, $recipient) {
   global $attachment_chunk, $attachment_name, $attachment_type, $attachment_sent, $bcc;
 
   $ob = "----=_OuterBoundary_000";
   $ib = "----=_InnerBoundery_001";
   
   $headers  = "MIME-Version: 1.0\r\n"; 
   $headers .= "From: ".$email."\n"; 
   $headers .= "To: ".$recipient."\n"; 
   $headers .= "Reply-To: ".$email."\n";
   if ($bcc) $headers .= "Bcc: ".$bcc."\n"; 
   $headers .= "X-Priority: 1\n"; 
   $headers .= "X-Mailer: DT Formmail".VERSION."\n"; 
   $headers .= "Content-Type: multipart/mixed;\n\tboundary=\"".$ob."\"\n";
   
          
   $message  = "This is a multi-part message in MIME format.\n";
   $message .= "\n--".$ob."\n";
   $message .= "Content-Type: multipart/alternative;\n\tboundary=\"".$ib."\"\n\n";
   $message .= "\n--".$ib."\n";
   $message .= "Content-Type: text/plain;\n\tcharset=\"iso-8859-1\"\n";
   $message .= "Content-Transfer-Encoding: quoted-printable\n\n";
   $message .= $content."\n\n";
   $message .= "\n--".$ib."--\n";
   if ($attachment_name && !$attachment_sent) {
      $message .= "\n--".$ob."\n";
      $message .= "Content-Type: $attachment_type;\n\tname=\"".$attachment_name."\"\n";
      $message .= "Content-Transfer-Encoding: base64\n";
      $message .= "Content-Disposition: attachment;\n\tfilename=\"".$attachment_name."\"\n\n";
      $message .= $attachment_chunk;
      $message .= "\n\n";
      $attachment_sent = 1;
   }
   $message .= "\n--".$ob."--\n";
   
   mail($recipient, $subject, $message, $headers);
}
 
// take in the body building arguments and build the body tag for page display
function build_body($title, $bgcolor, $text_color, $link_color, $vlink_color, $alink_color, $style_sheet) {
   if ($style_sheet)
      echo "<LINK rel=STYLESHEET href=\"$style_sheet\" Type=\"text/css\">\n";
   if ($title)
      echo "<title>$title</title>\n";
   if (!$bgcolor)
      $bgcolor = "#FFFFFF";
   if (!$text_color)
      $text_color = "#000000";
   if (!$link_color)
      $link_color = "#0000FF";
   if (!$vlink_color)
      $vlink_color = "#FF0000";
   if (!$alink_color)
      $alink_color = "#000088";
   if ($background)
      $background = "background=\"$background\"";
   echo "<body bgcolor=\"$bgcolor\" text=\"$text_color\" link=\"$link_color\" vlink=\"$vlink_color\" alink=\"$alink_color\" $background>\n\n";
}
 
// check for a recipient email address and check the validity of it
// Thanks to Bradley miller (bradmiller@accesszone.com) for pointing
// out the need for multiple recipient checking and providing the code.
$recipient_in = split(',',$recipient);
for ($i=0;$i<count($recipient_in);$i++) {
   $recipient_to_test = trim($recipient_in[$i]);
   if (!eregi("^[_\\.0-9a-z-]+@([0-9a-z][0-9a-z-]+\\.)+[a-z]{2,6}$", $recipient_to_test)) {
      print_error("<b>I NEED VALID RECIPIENT EMAIL ADDRESS ($recipient_to_test) TO CONTINUE</b>");
   }
}
 
// This is because I originally had it require but too many people
// were used to Matt's Formmail.pl which used required instead.
if ($required)
   $require = $required;
// handle the required fields
if ($require) {
   // seperate at the commas
   $require = ereg_replace( " +", "", $require);
   $required = split(",",$require);
   for ($i=0;$i<count($required);$i++) {
      $string = trim($required[$i]);
      // check if they exsist
      if((!(${$string})) || (!(${$string}))) {
         // if the missing_fields_redirect option is on: redirect them
         if ($missing_fields_redirect) {
            header ("Location: $missing_fields_redirect");
            exit;
         }
         $require;
         $missing_field_list .= "<b>Missing: $required[$i]</b><br>\n";
      }
   }
   // send error to our mighty error function
   if ($missing_field_list)
      print_error($missing_field_list,"missing");
}
 
// check the email fields for validity
if (($email) || ($EMAIL)) {
   $email = trim($email);
   if ($EMAIL) $email = trim($EMAIL);
   if (!eregi("^[_\.0-9a-z-]+@([0-9a-z][0-9a-z-]+\.)+[a-z]{2,6}$", $email))
      print_error("your <b>email address</b> is invalid");
   $EMAIL = $email;
}
 
// check zipcodes for validity
if (($ZIP_CODE) || ($zip_code)) {
   $zip_code = trim($zip_code);
   if ($ZIP_CODE) $zip_code = trim($ZIP_CODE);
   if (!ereg("(^[0-9]{5})-([0-9]{4}$)", trim($zip_code)) && (!ereg("^[a-zA-Z][0-9][a-zA-Z][[:space:]][0-9][a-zA-Z][0-9]$", trim($zip_code))) && (!ereg("(^[0-9]{5})", trim($zip_code))))
      print_error("your <b>zip/postal code</b> is invalid");
}
 
// check phone for validity
if (($PHONE_NO) || ($phone_no)) {
   $phone_no = trim($phone_no);
   if ($PHONE_NO) $phone_no = trim($PHONE_NO);
   if (!ereg("(^(.*)[0-9]{3})(.*)([0-9]{3})(.*)([0-9]{4}$)", $phone_no))
      print_error("your <b>phone number</b> is invalid");
}
 
// check phone for validity
if (($FAX_NO) || ($fax_no)) {
   $fax_no = trim($fax_no);
   if ($FAX_NO) $fax_no = trim($FAX_NO);
   if (!ereg("(^(.*)[0-9]{3})(.*)([0-9]{3})(.*)([0-9]{4}$)", $fax_no))
      print_error("your <b>fax number</b> is invalid");
}
 
// sort alphabetic or prepare an order
if ($sort == "alphabetic") {
   uksort($HTTP_POST_VARS, "strnatcasecmp");
} elseif ((ereg('^order:.*,.*', $sort)) && ($list = explode(',', ereg_replace('^order:', '', $sort)))) {
   $sort = $list;
}
   
// prepare the content
$content = parse_form($HTTP_POST_VARS, $sort);
 
// check for an attachment if there is a file upload it
if ($attachment_name) {
   if ($attachment_size > 0) {
      if (!$attachment_type) $attachment_type =  "application/unknown";
      $content .= "Attached File: ".$attachment_name."\n";
      $fp = fopen($attachment,  "r");
      $attachment_chunk = fread($fp, filesize($attachment));
      $attachment_chunk = base64_encode($attachment_chunk);
      $attachment_chunk = chunk_split($attachment_chunk);
   }
}
 
// check for a file if there is a file upload it
if ($file_name) {
   if ($file_size > 0) {
      if (!ereg("/$", $path_to_file))
         $path_to_file = $path_to_file."/";
      $location = $path_to_file.$file_name;
      if (file_exists($path_to_file.$file_name))
         $location = $path_to_file.rand(1000,3000).".".$file_name;
      copy($file,$location);
      unlink($file);
      $content .= "Uploaded File: ".$location."\n";
   }
}
 
// second file (see manual for instructions on how to add more.)
if ($file2_name) {
   if ($file_size > 0) {
      if (!ereg("/$", $path_to_file))
         $path_to_file = $path_to_file."/";
      $location = $path_to_file.$file2_name;
      if (file_exists($path_to_file.$file2_name))
         $location = $path_to_file.rand(1000,3000).".".$file2_name;
      copy($file2,$location);
      unlink($file2);
      $content .= "Uploaded File: ".$location."\n";
   }
}
 
// if the env_report option is on: get eviromental variables
if ($env_report) {
   $env_report = ereg_replace( " +", "", $env_report);
   $env_reports = split(",",$env_report);
   $content .= "\n------ eviromental variables ------\n";
   for ($i=0;$i<count($env_reports);$i++) {
      $string = trim($env_reports[$i]);
      if ($env_reports[$i] == "REMOTE_HOST")
         $content .= "REMOTE HOST: ".$REMOTE_HOST."\n";
      if ($env_reports[$i] == "REMOTE_USER")
         $content .= "REMOTE USER: ". $REMOTE_USER."\n";
      if ($env_reports[$i] == "REMOTE_ADDR")
         $content .= "REMOTE ADDR: ". $REMOTE_ADDR."\n";
      if ($env_reports[$i] == "HTTP_USER_AGENT")
         $content .= "BROWSER: ". $HTTP_USER_AGENT."\n";
   }
}
 
// send it off
mail_it(stripslashes($content), ($subject)?stripslashes($subject):"Form Submission", $email, $recipient);
if (file_exists($ar_file)) {
   $fd = fopen($ar_file, "rb");
   $ar_message = fread($fd, filesize($ar_file));
   fclose($fd);
   mail_it($ar_message, ($ar_subject)?stripslashes($ar_subject):"RE: Form Submission", ($ar_from)?$ar_from:$recipient, $email);
}
 
    // if the redirect URL is set: redirect them
   $redirect=("http://bouncycastle.net.au/thankyou.htm");
   if (isset($redirect)) {
   header("Location: $redirect");
   } else {
   echo "Thank you for your submission, someone will be in contact with you soon.";
      exit;
   }
 
 
// <----------    THE END    ----------> //  
Please help. Thank you

Re: The submitted form- enlarge text in received email? UGLY

Posted: Fri Sep 18, 2009 7:34 pm
by Christopher
That software seems to support MIME, so I suspect that you can put HTML into the email.

Re: The submitted form- enlarge text in received email? UGLY

Posted: Sat Sep 19, 2009 2:25 am
by ducatigirl67
arborint wrote:That software seems to support MIME, so I suspect that you can put HTML into the email.
Please tell me how and where it would go

Re: The submitted form- enlarge text in received email? UGLY

Posted: Sat Sep 19, 2009 8:03 am
by jackpf
Umm...in the email?

Re: The submitted form- enlarge text in received email? UGLY

Posted: Sat Sep 19, 2009 8:25 am
by ducatigirl67
jackpf wrote:Umm...in the email?
The form gets submitted and sent to someone else, how do you propose I edit the email?
Its the code I want to change so the email is received in a larger font...

Re: The submitted form- enlarge text in received email? UGLY

Posted: Sat Sep 19, 2009 9:40 am
by jackpf
Well, the email body is stored in the $message variable.

Just edit the value of $message to whatever you want.

Re: The submitted form- enlarge text in received email? UGLY

Posted: Sat Sep 19, 2009 5:23 pm
by ducatigirl67
jackpf wrote:Well, the email body is stored in the $message variable.

Just edit the value of $message to whatever you want.
ok thanks, I'm starting to get a clue :)
Can you suggest something?
as you have probably figured I know almost zilch about php language, and as I didnt know what to look for I was aimlessly searching google and getting nowhere. Hence I came here. hoping someone would know what I was looking for and give me a hand.
I would REALLY appreciate a snippet of code to give me a size 14/16 font (as the recipient is visually impaired)
I would put $message font size 16, you see?

Thank you

Re: The submitted form- enlarge text in received email? UGLY

Posted: Sat Sep 19, 2009 6:32 pm
by jackpf
Try this (untested):

Code: Select all

<?
/*
##############################################################################
# PLEASE DO NOT REMOVE THIS HEADER!!!
#
# COPYRIGHT NOTICE
#
# FormMail.php v5.0
# Copyright 2000-2004 Ai Graphics and Joe Lumbroso (c) All rights reserved.
# Created 07/06/2000   Last Modified 10/28/2003
# Joseph Lumbroso, http://www.aigraphics.com, http://www.dtheatre.com
#                  http://www.dtheatre.com/scripts/
##############################################################################
#
# This cannot and will not be inforced but I would appreciate a link back
# to any of these sites:
# http://www.dtheatre.com
# http://www.aigraphics.com
# http://www.dtheatre.com/scripts/
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
# OTHER DEALINGS IN THE SOFTWARE.
#
##############################################################################
*/
 
// for ultimate security, use this instead of using the form
$recipient = "bouncybounce@optusnet.com.au"; // bouncybounce@optusnet.com.au
 
// bcc emails (separate multiples with commas (,))
$bcc = "";
 
// referers.. domains/ips that you will allow forms to
// reside on.
$referers = array ('somedomain.com','www.somedomain.com','121.0.0.111');
 
// field / value seperator
define("SEPARATOR", ($separator)?$separator:": ");
 
// content newline
define("NEWLINE", ($newline)?$newline:"\n");
 
// formmail version (for debugging mostly)
define("VERSION", "5.0");
 
 
// our mighty error function..
function print_error($reason,$type = 0) {
   build_body($title, $bgcolor, $text_color, $link_color, $vlink_color, $alink_color, $style_sheet);
   // for missing required data
   if ($type == "missing") {
      if ($missing_field_redirect) {
         header("Location: $missing_field_redirect?error=$reason");
         exit;
      } else {
      ?>
      The form was not submitted for the following reasons:<p>
      <ul><?
      echo $reason."\n";
      ?></ul>
      Please use your browser's back button to return to the form and try again.<?
     }
  } else { // every other error
     ?>
     The form was not submitted because of the following reasons:
     <?
  }
  echo "<br>\n";
  exit;
}
 
 
 
// This function takes the sorts, excludes certain keys and
// makes a pretty content string.
function parse_form($array, $sort = "") {
  // build reserved keyword array
  $reserved_keys[] = "MAX_FILE_SIZE";
  $reserved_keys[] = "required";
  $reserved_keys[] = "redirect";
  $reserved_keys[] = "require";
  $reserved_keys[] = "path_to_file";
  $reserved_keys[] = "recipient";
  $reserved_keys[] = "subject";
  $reserved_keys[] = "sort";
  $reserved_keys[] = "style_sheet";
  $reserved_keys[] = "bgcolor";
  $reserved_keys[] = "text_color";
  $reserved_keys[] = "link_color";
  $reserved_keys[] = "vlink_color";
  $reserved_keys[] = "alink_color";
  $reserved_keys[] = "title";
  $reserved_keys[] = "missing_fields_redirect";
  $reserved_keys[] = "env_report";
  $reserved_keys[] = "submit";
  if (count($array)) {
     if (is_array($sort)) {
        foreach ($sort as $field) {
           $reserved_violation = 0;
           for ($ri=0; $ri<count($reserved_keys); $ri++)
              if ($array[$field] == $reserved_keys[$ri]) $reserved_violation = 1;
 
           if ($reserved_violation != 1) {
              if (is_array($array[$field])) {
                 for ($z=0;$z<count($array[$field]);$z++)
                    $content .= $field.SEPARATOR.$array[$field][$z].NEWLINE;
              } else
                 $content .= $field.SEPARATOR.$array[$field].NEWLINE;
           }
        }
     }
     while (list($key, $val) = each($array)) {
        $reserved_violation = 0;
        for ($ri=0; $ri<count($reserved_keys); $ri++)
           if ($key == $reserved_keys[$ri]) $reserved_violation = 1;
 
        for ($ri=0; $ri<count($sort); $ri++)
           if ($key == $sort[$ri]) $reserved_violation = 1;
 
        // prepare content
        if ($reserved_violation != 1) {
           if (is_array($val)) {
              for ($z=0;$z<count($val);$z++)
                 $content .= $key.SEPARATOR.$val[$z].NEWLINE;
           } else
              $content .= $key.SEPARATOR.$val.NEWLINE;
        }
     }
  }
  return $content;
}
 
// mail the content we figure out in the following steps
function mail_it($content, $subject, $email, $recipient) {
  global $attachment_chunk, $attachment_name, $attachment_type, $attachment_sent, $bcc;
 
  $ob = "----=_OuterBoundary_000";
  $ib = "----=_InnerBoundery_001";
 
  $headers  = "MIME-Version: 1.0\r\n";
  $headers .= "From: ".$email."\n";
  $headers .= "To: ".$recipient."\n";
  $headers .= "Reply-To: ".$email."\n";
  if ($bcc) $headers .= "Bcc: ".$bcc."\n";
  $headers .= "X-Priority: 1\n";
  $headers .= "X-Mailer: DT Formmail".VERSION."\n";
  $headers .= "Content-Type: multipart/mixed;\n\tboundary=\"".$ob."\"\n";
 
         
  $message  = "This is a multi-part message in MIME format.\n";
  $message .= "\n--".$ob."\n";
  $message .= "Content-Type: multipart/alternative;\n\tboundary=\"".$ib."\"\n\n";
  $message .= "\n--".$ib."\n";
  $message .= "Content-Type: text/plain;\n\tcharset=\"iso-8859-1\"\n";
  $message .= "Content-Transfer-Encoding: quoted-printable\n\n";
  $message .= $content."\n\n";
  $message .= "\n--".$ib."--\n";
  if ($attachment_name && !$attachment_sent) {
     $message .= "\n--".$ob."\n";
     $message .= "Content-Type: $attachment_type;\n\tname=\"".$attachment_name."\"\n";
     $message .= "Content-Transfer-Encoding: base64\n";
     $message .= "Content-Disposition: attachment;\n\tfilename=\"".$attachment_name."\"\n\n";
     $message .= $attachment_chunk;
     $message .= "\n\n";
     $attachment_sent = 1;
  }
  $message .= "\n--".$ob."--\n";
 
  mail($recipient, $subject, $message, $headers);
}
 
// take in the body building arguments and build the body tag for page display
function build_body($title, $bgcolor, $text_color, $link_color, $vlink_color, $alink_color, $style_sheet) {
  if ($style_sheet)
     echo "<LINK rel=STYLESHEET href=\"$style_sheet\" Type=\"text/css\">\n";
  if ($title)
     echo "<title>$title</title>\n";
  if (!$bgcolor)
     $bgcolor = "#FFFFFF";
  if (!$text_color)
     $text_color = "#000000";
  if (!$link_color)
     $link_color = "#0000FF";
  if (!$vlink_color)
     $vlink_color = "#FF0000";
  if (!$alink_color)
     $alink_color = "#000088";
  if ($background)
     $background = "background=\"$background\"";
  echo "<body bgcolor=\"$bgcolor\" text=\"$text_color\" link=\"$link_color\" vlink=\"$vlink_color\" alink=\"$alink_color\" $background>\n\n";
}
 
// check for a recipient email address and check the validity of it
// Thanks to Bradley miller (bradmiller@accesszone.com) for pointing
// out the need for multiple recipient checking and providing the code.
$recipient_in = split(',',$recipient);
for ($i=0;$i<count($recipient_in);$i++) {
  $recipient_to_test = trim($recipient_in[$i]);
  if (!eregi("^[_\\.0-9a-z-]+@([0-9a-z][0-9a-z-]+\\.)+[a-z]{2,6}$", $recipient_to_test)) {
     print_error("<b>I NEED VALID RECIPIENT EMAIL ADDRESS ($recipient_to_test) TO CONTINUE</b>");
  }
}
 
// This is because I originally had it require but too many people
// were used to Matt's Formmail.pl which used required instead.
if ($required)
   $require = $required;
// handle the required fields
if ($require) {
   // seperate at the commas
   $require = ereg_replace( " +", "", $require);
   $required = split(",",$require);
   for ($i=0;$i<count($required);$i++) {
      $string = trim($required[$i]);
      // check if they exsist
      if((!(${$string})) || (!(${$string}))) {
         // if the missing_fields_redirect option is on: redirect them
         if ($missing_fields_redirect) {
            header ("Location: $missing_fields_redirect");
            exit;
         }
         $require;
         $missing_field_list .= "<b>Missing: $required[$i]</b><br>\n";
      }
   }
   // send error to our mighty error function
   if ($missing_field_list)
      print_error($missing_field_list,"missing");
}
 
// check the email fields for validity
if (($email) || ($EMAIL)) {
   $email = trim($email);
   if ($EMAIL) $email = trim($EMAIL);
   if (!eregi("^[_\.0-9a-z-]+@([0-9a-z][0-9a-z-]+\.)+[a-z]{2,6}$", $email))
      print_error("your <b>email address</b> is invalid");
   $EMAIL = $email;
}
 
// check zipcodes for validity
if (($ZIP_CODE) || ($zip_code)) {
   $zip_code = trim($zip_code);
   if ($ZIP_CODE) $zip_code = trim($ZIP_CODE);
   if (!ereg("(^[0-9]{5})-([0-9]{4}$)", trim($zip_code)) && (!ereg("^[a-zA-Z][0-9][a-zA-Z][[:space:]][0-9][a-zA-Z][0-9]$", trim($zip_code))) && (!ereg("(^[0-9]{5})", trim($zip_code))))
      print_error("your <b>zip/postal code</b> is invalid");
}
 
// check phone for validity
if (($PHONE_NO) || ($phone_no)) {
   $phone_no = trim($phone_no);
   if ($PHONE_NO) $phone_no = trim($PHONE_NO);
   if (!ereg("(^(.*)[0-9]{3})(.*)([0-9]{3})(.*)([0-9]{4}$)", $phone_no))
      print_error("your <b>phone number</b> is invalid");
}
 
// check phone for validity
if (($FAX_NO) || ($fax_no)) {
   $fax_no = trim($fax_no);
   if ($FAX_NO) $fax_no = trim($FAX_NO);
   if (!ereg("(^(.*)[0-9]{3})(.*)([0-9]{3})(.*)([0-9]{4}$)", $fax_no))
      print_error("your <b>fax number</b> is invalid");
}
 
// sort alphabetic or prepare an order
if ($sort == "alphabetic") {
   uksort($HTTP_POST_VARS, "strnatcasecmp");
} elseif ((ereg('^order:.*,.*', $sort)) && ($list = explode(',', ereg_replace('^order:', '', $sort)))) {
   $sort = $list;
}
   
// prepare the content
$content = '<span style="font-size:16px;">'.parse_form($HTTP_POST_VARS, $sort);
 
// check for an attachment if there is a file upload it
if ($attachment_name) {
   if ($attachment_size > 0) {
      if (!$attachment_type) $attachment_type =  "application/unknown";
      $content .= "Attached File: ".$attachment_name."\n";
      $fp = fopen($attachment,  "r");
      $attachment_chunk = fread($fp, filesize($attachment));
      $attachment_chunk = base64_encode($attachment_chunk);
      $attachment_chunk = chunk_split($attachment_chunk);
   }
}
 
// check for a file if there is a file upload it
if ($file_name) {
   if ($file_size > 0) {
      if (!ereg("/$", $path_to_file))
         $path_to_file = $path_to_file."/";
      $location = $path_to_file.$file_name;
      if (file_exists($path_to_file.$file_name))
         $location = $path_to_file.rand(1000,3000).".".$file_name;
      copy($file,$location);
      unlink($file);
      $content .= "Uploaded File: ".$location."\n";
   }
}
 
// second file (see manual for instructions on how to add more.)
if ($file2_name) {
   if ($file_size > 0) {
      if (!ereg("/$", $path_to_file))
         $path_to_file = $path_to_file."/";
      $location = $path_to_file.$file2_name;
      if (file_exists($path_to_file.$file2_name))
         $location = $path_to_file.rand(1000,3000).".".$file2_name;
      copy($file2,$location);
      unlink($file2);
      $content .= "Uploaded File: ".$location."\n";
   }
}
 
// if the env_report option is on: get eviromental variables
if ($env_report) {
   $env_report = ereg_replace( " +", "", $env_report);
   $env_reports = split(",",$env_report);
   $content .= "\n------ eviromental variables ------\n";
   for ($i=0;$i<count($env_reports);$i++) {
      $string = trim($env_reports[$i]);
      if ($env_reports[$i] == "REMOTE_HOST")
         $content .= "REMOTE HOST: ".$REMOTE_HOST."\n";
      if ($env_reports[$i] == "REMOTE_USER")
         $content .= "REMOTE USER: ". $REMOTE_USER."\n";
      if ($env_reports[$i] == "REMOTE_ADDR")
         $content .= "REMOTE ADDR: ". $REMOTE_ADDR."\n";
      if ($env_reports[$i] == "HTTP_USER_AGENT")
         $content .= "BROWSER: ". $HTTP_USER_AGENT."\n";
   }
}
 $content .= '</span>';
// send it off
mail_it(stripslashes($content), ($subject)?stripslashes($subject):"Form Submission", $email, $recipient);
if (file_exists($ar_file)) {
   $fd = fopen($ar_file, "rb");
   $ar_message = fread($fd, filesize($ar_file));
   fclose($fd);
   mail_it($ar_message, ($ar_subject)?stripslashes($ar_subject):"RE: Form Submission", ($ar_from)?$ar_from:$recipient, $email);
}
 
    // if the redirect URL is set: redirect them
   $redirect=("http://bouncycastle.net.au/thankyou.htm");
   if (isset($redirect)) {
   header("Location: $redirect");
   } else {
   echo "Thank you for your submission, someone will be in contact with you soon.";
      exit;
   }
 
 
// <----------    THE END    ----------> //  

Re: The submitted form- enlarge text in received email? UGLY

Posted: Sun Sep 20, 2009 3:09 am
by ducatigirl67
Sorry but it doesnt work and the received email has this

<span style=ont-size:16px;">ar_file: /www/formmail_path/autoresponder.txt
ar_subject: Thank you for your interest!
name:
phone_no:
email:
hire: I am interested in hiring
I_am_interested_in_hiring: lil splash
I_want_to_book_it_for_this_date: january 21 2010
I_want_to_book_it_for_this_time: 9 am
How_many_hours_required: 4
Castle_location:
I_am_interested_in_purchasing:
Enquiry: testing testint testing
</span>

I'm trying different things, like I removed the ' tags around <span but that just gave me a syntax error.
This is driving me insane.
Thanks for trying :)

Re: The submitted form- enlarge text in received email? UGLY

Posted: Sun Sep 20, 2009 6:44 am
by jackpf
Hmm...try changing the content-type in the headers to text/html.

Re: The submitted form- enlarge text in received email? UGLY

Posted: Sun Sep 20, 2009 7:30 am
by ducatigirl67
it doesnt come through as plain text anymore, it is better looking BUT it comes in one long string, with no line breaks
and not 16 font.

ar_file: /www/formmail_path/autoresponder.txt ar_subject: Thank you for your interest! name: Bullet for my Valentine phone_no: 0000000000 email: nmnmnmn@westnet.com.au I_am_interested_in_hiring: bull I_want_to_book_it_for_this_date: january 21 2010 I_want_to_book_it_for_this_time: How_many_hours_required: Castle_location: I_am_interested_in_purchasing: Enquiry:

Re: The submitted form- enlarge text in received email? UGLY

Posted: Sun Sep 20, 2009 8:06 am
by ducatigirl67
no line breaks and it is not verifying the email address now.

Re: The submitted form- enlarge text in received email? UGLY

Posted: Sun Sep 20, 2009 8:31 am
by jackpf
Use nl2br() or <br /> tags.

Re: The submitted form- enlarge text in received email? UGLY

Posted: Sun Sep 20, 2009 10:44 am
by ducatigirl67
its already defined in the code that new line is \n\ I'm pretty sure.
I've actually read it all now trying to work out where things are.
It doesnt seem to like html <br> and I dont know how to write it, like with characters . = ] } you know all those are placed in a certain way for a reason, no clue how to add something into the code. I understand html start and closing tags etc, but not this php. At least it doesnt freak me out when I read it now.lol but still dont understand it and where to put variables in.
I need a php wizard :? :banghead: :)

Re: The submitted form- enlarge text in received email? UGLY

Posted: Sun Sep 20, 2009 2:21 pm
by jackpf
Yes, but the email is now HTML. New lines don't display. You need to replace \n with <br /> in $message.