Forum Moderators: coopster
if($_POST['referrer']!= '')
{$referrer = $_POST['referrer'];}
if($_POST['fname']!= '')
{$fname = $_POST['fname'];}
if($_POST['femail']!= '')
{$femail = $_POST['femail'];}
$to = ''.$femail.'';
$subject = ''.$fname.', '.$referrer.' Has A Recommendation For You...';
$message = 'RECOMMENDATION';
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$headers .= 'To: '.$fname.' <'.$femail.'>' . "\r\n";
$headers .= 'From: '.$referrer.'' . "\r\n";
$headers .= 'Reply-To: No Reply' . "\r\n";
$headers .= 'X-Mailer: PHP/' . phpversion() . " \r\n";
mail($to, $subject, $message, $headers);
header("Location: http://www.example.co.uk/thanks.php");
exit();
?>
Hello all,
The intention of this very stripped down mailer is that somebody enters their name (name=referrer), friends name and friends e-mail address (names=fname and femail respectively) in a form, and this script sends an e-mail to the 'femail' value recommending my site. Except, it doesn't.
Mans, this is like learning HTML all over again ;-) What's wrong this time?
[edited by: ergophobe at 4:17 pm (utc) on July 30, 2005]
[edit reason] please don't use three X for sample URL - might give SEs the wrong idea about us! [/edit]
$to = $femail;
$subject = "$fname, $referrer Has A Recommendation For You...";
$message = "RECOMMENDATION";
$headers = "MIME-Version: 1.0 \r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1 \r\n";
$headers .= "To: $fname <$femail> \r\n";
$headers .= "From: $referrer \r\n";
$headers .= "Reply-To: No Reply \r\n";
$headers .= "X-Mailer: PHP/" . phpversion() . " \r\n";
Variables in " " are being parsed, in ' ' are not.
Best regards
Michal Cibor
Apparently this isn't the case at all.
Looks like what you are referring to is concatenation, ie the joining of two strings together. I`m guessing you`ve seen somebody else`s code who has used multiple lines joining the data together. Its all down to personal preference, but no, variable values do not need to be enclosed in quotes.
dc