JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
improved documentation for email(), added error reporting to metaform,
[wfpl.git] / metaform / template.php
index 5a5c0ee..af98d96 100644 (file)
@@ -86,12 +86,18 @@ function ~form_name~() {
                                $message = tem_run('~form_name~.email.txt');
                                $cc = '';
                                $bcc = '';
-                               email($from, $to, $subject, $message, $cc, $bcc);
+                               if(email($from, $to, $subject, $message, $cc, $bcc)) {
+                                       tem_set('error_message', 'Due to an internal error, your message could not be sent. Please try again later.');
+                                       tem_sub('error');
+                                       $error = true;
+                               }
+                       }
+                       if($error !== true) {
+                               tem_load('~form_name~.html');
+                               tem_sub('thankyou');
+                               tem_output();
+                               exit();
                        }
-                       tem_load('~form_name~.html');
-                       tem_sub('thankyou');
-                       tem_output();
-                       exit();
                }
                # otherwise, we display the form again. ~form_name~_get_fields() has
                # already put the posted values back into the template engine, so they will