Professional Web Applications Themes

[php] formmail.pl formmail.php - PHP Development

Not that formmail.pl was the most secure idea, but it could take any variable off any form and mail the contents to a vriable on that form. Does anyone know of such a critter in existence for PHP, a script that will read in all variable on any form and email them. Something already created? Any use of formmail.pl these days would need updating to protect it from spamming. Anything available? -- John Taylor-Johnston ----------------------------------------------------------------------------- "If it's not open-source, it's Murphy's Law." ' ' ' Collège de Sherbrooke: ô¿ô [url]http://www.collegesherbrooke.qc.ca/languesmodernes/[/url] - Université de Sherbrooke: [url]http://compcanlit.ca/[/url] 819-569-2064...

  1. #1

    Default [php] formmail.pl formmail.php

    Not that formmail.pl was the most secure idea, but it could take any variable off any form and mail the contents to a vriable on that form. Does anyone know of such a critter in existence for PHP, a script that will read in all variable on any form and email them. Something already created? Any use of formmail.pl these days would need updating to protect it from spamming. Anything available?

    --
    John Taylor-Johnston
    -----------------------------------------------------------------------------
    "If it's not open-source, it's Murphy's Law."

    ' ' ' Collège de Sherbrooke:
    ô¿ô [url]http://www.collegesherbrooke.qc.ca/languesmodernes/[/url]
    - Université de Sherbrooke:
    [url]http://compcanlit.ca/[/url]
    819-569-2064
    John Taylor-Johnston Guest

  2. #2

    Default Re: [PHP] [php] formmail.pl formmail.php

    Hi,

    Monday, September 22, 2003, 11:34:25 AM, you wrote:
    JTJ> Not that formmail.pl was the most secure idea, but it could take any
    JTJ> variable off any form and mail the contents to a vriable on that form. Does
    JTJ> anyone know of such a critter in existence for PHP, a script that will read
    JTJ> in all variable on any form and email them. Something already created? Any
    JTJ> use of formmail.pl these days would need updating to protect it from
    JTJ> spamming. Anything available?

    JTJ> --
    JTJ> John Taylor-Johnston
    JTJ> -----------------------------------------------------------------------------
    JTJ> "If it's not open-source, it's Murphy's Law."

    JTJ> ' ' ' Collège de Sherbrooke:
    JTJ> ô¿ô [url]http://www.collegesherbrooke.qc.ca/languesmodernes/[/url]
    JTJ> - Université de Sherbrooke:
    JTJ> [url]http://compcanlit.ca/[/url]
    JTJ> 819-569-2064


    Here is a class I use to get you started

    <?
    class doFormsClass {
    var $text = '';
    var $vars = array();
    var $emailto = '';
    function doFormsClass(){
    if(!empty($_POST['EmailTo'])){
    $this->emailto = $_POST['EmailTo'];
    $today = Date("d/m/Y H:i:s");
    $this->text = "Form submitted on $today\n\n"; //$text holds the email message
    $this->vars['vars']['header'] = 'Form submitted on '.$today;
    $x = 0;
    while (list($k, $v)=each($_POST)) { //loop through all the variables sent
    switch($k){ //and break on keywords
    case("EmailTo"):
    $this->vars['vars']['mailto'] = $v;
    break;
    case 'Quiet':
    case 'PHPSESSID':
    case 'Email2':
    case 'FormBackground':
    case 'FormBottomMessage':
    case 'FormTopMessage':
    case 'FormSubject':
    case 'FormRedirect':
    case 'submit':
    case 'MAIL':
    break; //drop all of these
    default: //otherwise not a keyword
    $k = ereg_replace("_"," ",$k); //get rid of _ and replace with a space
    if($v == "BR"){ //if BR add a carriage return,used for making blank line
    $this->vars['blocks']['submit'][$x]['dropif']['break'] = '&nbsp;';
    $this->text .= "\n";
    }else{
    $this->vars['blocks']['submit'][$x]['vars']['name'] = $k;
    $this->vars['blocks']['submit'][$x]['vars']['value'] = $v;
    $this->text .= "$k : $v\n"; //add the variable name and value to email
    }
    $x++;
    break;
    }
    }
    }
    if(isset($_POST['FormSubject'])){
    $subject = $_POST['FormSubject'];
    }else{
    $subject = "Form submitted $today";
    }
    $this->vars['vars']['subject'] = $subject;
    if(isset($_POST['Email']) || isset($_POST['email'])){
    if(isset($_POST['Email'])):
    $tail = "FROM: ".$_POST['Email'];
    else:
    $tail = "FROM: ".$_POST['email'];
    endif;
    }
    else{
    $tail = "FROM: Unknown";
    }
    mail($_POST['EmailTo'],$subject,$this->text,$tail); //send the email
    if(isset($_POST['Email2'])){
    mail($_POST['Email2'],$subject,$text,$tail); //send CC if needed
    }
    }
    function getVars(){
    return $this->vars;
    }
    }


    The form would start like this
    <?
    if(isset($_POST['EmailTo'])){
    $df = new doforms(){ //will send the form off by mail
    //display form answers/thankyou message here
    }else{
    ?>
    <form action="<?echo $_SERVER['PHP_SELF']?>" method="post">
    <input type="hidden" name="EmailTo" value="email adress of who gets the form">
    <input type="hidden" name="FormSubject" value="Test form">
    Tom Rogers Guest

Similar Threads

  1. FormMail help needed
    By gpots in forum Macromedia Dynamic HTML
    Replies: 0
    Last Post: November 1st, 01:30 AM
  2. formmail.cgi problem
    By Marcel in forum PERL Modules
    Replies: 5
    Last Post: June 3rd, 10:14 AM
  3. FormMail
    By Maurizio Forneris in forum Macromedia Flash
    Replies: 1
    Last Post: September 30th, 03:30 PM
  4. Formmail.asp access denied
    By Matt W. in forum ASP
    Replies: 2
    Last Post: September 9th, 01:32 PM
  5. formmail question PLEASE HELP
    By Alan Ames in forum Macromedia Dreamweaver
    Replies: 3
    Last Post: July 10th, 02:01 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139