Title: Mailer.php
Last modified: August 19, 2016

---

# Mailer.php

 *  [odaku128](https://wordpress.org/support/users/odaku128/)
 * (@odaku128)
 * [16 years, 4 months ago](https://wordpress.org/support/topic/mailerphp/)
 * I use a mailer.php to email form data to an external email address.
 * The one i normally use does not work inside wordpress.
 * It simply will not process the form data and also the redirect does nothing.
 * Does anyone know how to resolve this?
 * My forms have four fields and i need the data and date and time sent.
 * Cheers

Viewing 1 replies (of 1 total)

 *  Thread Starter [odaku128](https://wordpress.org/support/users/odaku128/)
 * (@odaku128)
 * [16 years, 4 months ago](https://wordpress.org/support/topic/mailerphp/#post-1384068)
 * Do Mailer.php’s work inside of wordpress?
 * Is There a special way to write them?
 * This is mine:
 *     ```
       <?php
       $to = "to";
       $subject = "subject";
       $headers = "From: header";
       $forward = 1;
       $location = "http://www.site.com";
       $date = date ("l, F jS, Y");
       $time = date ("h:i A"); 
   
       $msg = "Below is the result of your feedback form. It was submitted on $date at $time.\n\n"; 
   
       if ($_SERVER['REQUEST_METHOD'] == "POST") {
           foreach ($_POST as $key => $value) {
               $msg .= ucfirst ($key) ." : ". $value . "\n";
           }
       }
       else {
           foreach ($_GET as $key => $value) {
               $msg .= ucfirst ($key) ." : ". $value . "\n";
           }
       }
   
       mail($to, $subject, $msg, $headers, -f$headers);
       if ($forward == 1) {
           header ("Location:$location");
       }
       else {
           echo "Thank you for submitting our form. We will get back to you as soon as possible.";
       } 
   
       ?>
       ```
   

Viewing 1 replies (of 1 total)

The topic ‘Mailer.php’ is closed to new replies.

## Tags

 * [mail](https://wordpress.org/support/topic-tag/mail/)

 * 1 reply
 * 1 participant
 * Last reply from: [odaku128](https://wordpress.org/support/users/odaku128/)
 * Last activity: [16 years, 4 months ago](https://wordpress.org/support/topic/mailerphp/#post-1384068)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
