0

I want to replace default webmaster email from my email it's not working in php script.
I have tried reply-to but it's not working This is my php code.

$headers= "Reply-To: my@email.com\n";

mail($to,$subject,$body,$headers);
  • Do you get any errors ? – krishna May 13 '14 at 10:07
  • There are a lot of similar questions about this, I suggest you to [check these answers out](http://stackoverflow.com/questions/17418751/reply-to-sender-php-email) – Arko Elsenaar May 13 '14 at 10:07
  • Is `$headers` already defined? – Rahil Wazir May 13 '14 at 10:09
  • This is my code. $headers = 'From: admin@adventureclicknblog.com' . "\r\n" ; $headers .= 'Reply-To: admin@adventureclicknblog.com' . "\r\n"; $headers .= 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; When I send email from this script it's send but reply-to email come with this email webmaster email clicknbl@rsj17.rhostjh.com I dont know how to change it. – aman sikarwar May 13 '14 at 10:40

2 Answers2

1

Try a simple structure (source: PHP.net - mail())

<?php
$to      = 'nobody@example.com';
$subject = 'the subject';
$message = 'hello';
$headers = 'From: webmaster@example.com' . "\r\n" .
    'Reply-To: webmaster@example.com' . "\r\n" .
    'X-Mailer: PHP/' . phpversion();

mail($to, $subject, $message, $headers);
?>
John Priestakos
  • 415
  • 4
  • 19
0

i don't know about your php-version, but mine doesn't like spaces when concatenetating with .=

try to remove the space here:

$headers .= "Reply-To: my@email.com\n";

so you get:

$headers.= "Reply-To: my@email.com\n";

(giving us information about whether you are getting an error-message and if so, which one - would have helped quite a lot, when my suggestion is right)

low_rents
  • 4,481
  • 3
  • 27
  • 55