From: Jason Woofenden Date: Tue, 12 Jan 2010 09:45:35 +0000 (-0500) Subject: metaform e-mails default to from: noreply@[thisdomain] X-Git-Url: https://jasonwoof.com/gitweb/?p=wfpl.git;a=commitdiff_plain;h=c8c3188b38830c22f77de3bb6ae035b26c481077 metaform e-mails default to from: noreply@[thisdomain] --- diff --git a/metaform.php b/metaform.php index 47ce7fe..ee5b942 100644 --- a/metaform.php +++ b/metaform.php @@ -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'); } diff --git a/metaform/template.php b/metaform/template.php index 32c6a70..520ca57 100644 --- a/metaform/template.php +++ b/metaform/template.php @@ -11,7 +11,7 @@ # SETUP # 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'; # 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() { db_insert('~table_name~', ~file_name upper~_DB_FIELDS, ~php_fields~); message('~singular cap~ saved.'); } - 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) {