Title: PHP Mail Problem
Last modified: August 19, 2016

---

# PHP Mail Problem

 *  Resolved [dipaksaraf](https://wordpress.org/support/users/dipaksaraf/)
 * (@dipaksaraf)
 * [15 years, 2 months ago](https://wordpress.org/support/topic/php-mail-problem/)
 * I am using PHP mail functionality to send mail whenever a user submits the feedback
   on a post.
 * The codes are something like this :
    <?php $headers = ‘From: [automated_message@somedomain.com](https://wordpress.org/support/topic/php-mail-problem/automated_message@somedomain.com?output_format=md)’.”\
   r\n” . ‘CC: [abc@somedomain.com](https://wordpress.org/support/topic/php-mail-problem/abc@somedomain.com?output_format=md)’.”\
   r\n”. ‘Reply-To:$_REQUEST[‘contactemail’]’.”\r\n”;
 * if ($_REQUEST[‘contactemail’]){
    mail($to, ‘Response to somedomain.com Ad’, $
   body.$editlink,$headers); mail($_REQUEST[‘contactemail’], ‘Response to somedomain.
   com Ad’, $client_tag.$body, $headers); }else{ echo'<h2>You seem to have entered
   an invalid e-mail address. Please try again.’; } ?>
 * When i am using email address in Reply-To: [someeamilid@somedomain.com](https://wordpress.org/support/topic/php-mail-problem/someeamilid@somedomain.com?output_format=md)
   it works but when i use $_REQUEST[‘contactemail’] , it gives an error which is
   as follows: Parse error: syntax error, unexpected T_STRING in runtime.php(42):
   eval()’d code on line 24.
 * LIne 24 is: $headers = ‘From: [automated_message@somedomain.com](https://wordpress.org/support/topic/php-mail-problem/automated_message@somedomain.com?output_format=md)’.”\
   r\n” .
    ‘CC: [abc@somedomain.com](https://wordpress.org/support/topic/php-mail-problem/abc@somedomain.com?output_format=md)’.”\
   r\n”. ‘Reply-To:$_REQUEST[‘contactemail’]’.”\r\n”;
 * Please suggest how o resolve this issue.
 * Thanks
    Dipak

Viewing 2 replies - 1 through 2 (of 2 total)

 *  [Curtiss Grymala](https://wordpress.org/support/users/cgrymala/)
 * (@cgrymala)
 * [15 years, 2 months ago](https://wordpress.org/support/topic/php-mail-problem/#post-2026361)
 * The $_REQUEST information is a PHP variable, but since you have it inside of 
   single-quotes, it’s being treated as a string. Then, the single-quote that wraps`
   contactemail` is actually exiting the quoted string, leaving `contactemail` as
   plain text outside of a string definition.
 * So, PHP thinks you want to send a message to someone with the e-mail address 
   of `$_REQUEST[`, then it sees `contactemail` right next to that and doesn’t know
   what to do with it. Try this code instead:
 *     ```
       'Reply-To:' . $_REQUEST['contactemail'] ."\r\n";
       ```
   
 *  Thread Starter [dipaksaraf](https://wordpress.org/support/users/dipaksaraf/)
 * (@dipaksaraf)
 * [15 years, 2 months ago](https://wordpress.org/support/topic/php-mail-problem/#post-2026390)
 * Hello Curtis
 * Thanks for the help, after changing the code as suggested, the mail is working
   smoothly.
 * Thanks for the Help…….
 * Dipak

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘PHP Mail Problem’ is closed to new replies.

## Tags

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

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 2 replies
 * 2 participants
 * Last reply from: [dipaksaraf](https://wordpress.org/support/users/dipaksaraf/)
 * Last activity: [15 years, 2 months ago](https://wordpress.org/support/topic/php-mail-problem/#post-2026390)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
