JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
metaform e-mails default to from: noreply@[thisdomain]
authorJason Woofenden <jason@jasonwoof.com>
Tue, 12 Jan 2010 09:45:35 +0000 (04:45 -0500)
committerJason Woofenden <jason@jasonwoof.com>
Tue, 12 Jan 2010 09:45:35 +0000 (04:45 -0500)
metaform.php
metaform/template.php

index 47ce7fe..ee5b942 100644 (file)
@@ -434,6 +434,11 @@ function make_php() {
                $tem->show('opt_db_5');
        }
        if($GLOBALS['opt_email'] == 'Yes') {
+               $this_domain = $_SERVER['HTTP_HOST'];
+               if(substr($this_domain, -2) == '.l') {
+                       $this_domain = substr($this_domain, 0, -1) . 'com';
+               }
+               $tem->set('this_domain', $this_domain);
                $tem->show('opt_email_1');
                $tem->show('opt_email_2');
        }
index 32c6a70..520ca57 100644 (file)
@@ -11,7 +11,7 @@
 # SETUP
 <!--~opt_email_1 {~-->
 # To send results by e-mail, all you have to do is set your e-mail address here:
-$GLOBALS['~file_name~_form_recipient'] = "fixme@example.com";
+$GLOBALS['~file_name~_form_recipient'] = 'fixme@example.com';
 <!--~}~--><!--~opt_db_1 {~-->
 # To save results to a database, you'll need to create the ~table_name~ table
 # (the file ~file_name~.sql should help with this), and create the file
@@ -171,10 +171,10 @@ function _~file_name~_main() {<!--~}~--><!--~opt_pass {~-->
                                db_insert('~table_name~', ~file_name upper~_DB_FIELDS, ~php_fields~);
                                message('~singular cap~ saved.');
                        }<!--~}~--><!--~opt_email_2 {~-->
-                       if($GLOBALS['~file_name~_form_recipient'] != "fixme@example.com") {
+                       if($GLOBALS['~file_name~_form_recipient'] != 'fixme@example.com') {
                                $to = $GLOBALS['~file_name~_form_recipient'];
-                               $from = $to;
-                               $reply_to = '';
+                               $from = 'noreply@~this_domain~';
+                               $reply_to = $to;
                                if(isset($_REQUEST['email']) and valid_email($_REQUEST['email'])) {
                                        $reply_to = $_REQUEST['email'];
                                        if($_REQUEST['name'] and ereg('^[a-zA-Z0-9_\' -]*$', $_REQUEST['name']) !== false) {