I want the following: "please@dont.reply" to show up.

the mail() function

Moderators: macek, egami, gesf

openbody
New php-forum User
New php-forum User
Posts: 1
Joined: Tue Aug 09, 2011 12:47 am

I want the following: "please@dont.reply" to show up.

Postby openbody » Tue Aug 09, 2011 2:15 am

Hi in the following code I would not like the receiver of the email to be able to see the server mailer address. Instead I would like please@dont.reply or something to that affect.

Please assist. :)

<?php

$name = $_POST["name"];
$feedback = $_POST["feedback"];
$from = $_POST["from"];
$verif_box = $_POST["verif_box"];

$feedback = stripslashes($feedback);
$name = stripslashes($name);
$from = stripslashes($from);

if(md5($verif_box).'a4xn' == $_COOKIE['tntcon']){

mail("your.email@here.com", 'index.php: '.$name, $_SERVER['REMOTE_ADDR']."\n\n".$feedback, "From: $from");
mail($from, "Do not reply!",
"Thank you! Your email form has been submitted successfully. Please do not reply to this email.");

setcookie('tntcon','');
} else if(isset($feedback) and $feedback!=""){

header("Location: index.php?name=$name&from=$from&feedback=".urlencode($feedback)."&wrong_code=true");
exit;
} else {
echo "no variables received, this page cannot be accessed directly";
exit;
}
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>email - success</title>

<style type="text/css">
<!--
body,td,th {
font-family: Arial, Helvetica, sans-serif;
font-size: 12px;
}
-->
</style>
</head>

<body>
<h2>
Thank you!
<br /><br />
Your email has been submitted successfully.
<br /><br />
</h2>

<h3>
You may close this window now.
</h3>
</body>

</html>

User avatar
egami
php-forum GURU
php-forum GURU
Posts: 2196
Joined: Wed Oct 06, 2010 11:19 am
Location: Happy Valley, UT

Re: I want the following: "please@dont.reply" to show up.

Postby egami » Tue Aug 09, 2011 5:00 am

This is done in the HEADERS section of the mail function.

$headers = 'FROM: Do Not Reply[noreply@mydomain.com]'."\r\n";

for more info, php.net/mail


Return to “PHP coding => Mail”

Who is online

Users browsing this forum: Google [Bot] and 2 guests