WordPress Contact E-Mail Form

Naively, I put up email addresses for sales, information, and site feedback on the Contact Us page. The spam robots discovered these email addresses and have begun to spam me.

Fortunately there is a WordPress plugin, PXS Mail Form, for email forms that seems quite mature and even protects against exploits. You can see how it is used on this page.

I made only one change to this plugin that allows you to set the subject of the email form using a GET request. Previously you could only do this using a POST request.

***************
*** 58,69 ****
              } else {
              $show_subject = 1;
              $subject = '';
!             if (empty($_POST['your_subject'])) {
              $subject = get_option('pxs_subject');
              $subject = stripslashes($subject);
              $subject_mm = '';
              } else {
!             $subject = $_POST['your_subject'];
              $subject = stripslashes($subject);
              $subject_mm =  ': '.$subject;
              }
--- 58,69 ----
              } else {
              $show_subject = 1;
              $subject = '';
!             if (empty($_REQUEST['your_subject'])) {
              $subject = get_option('pxs_subject');
              $subject = stripslashes($subject);
              $subject_mm = '';
              } else {
!             $subject = $_REQUEST['your_subject'];
              $subject = stripslashes($subject);
              $subject_mm =  ': '.$subject;
              }

Leave a Reply

Your email address will not be published. Required fields are marked *