Page is a not externally linkable
rocknbil - 5:50 pm on Nov 18, 2011 (gmt 0)
Just a FYI . . . was going to mention this in your recent posts on email problems . . if you want an elegant mail "from" header that uses the user's/company name, you were really close but the format is like this:
From: "John Doe" <email@example.com>
in code . . .
$headers = "From: \$fname $lname \" <$email>\n";
if you really want it trouble free, accomodate both - with or without a name - so you never have to touch this block again (if you put it in a function) ...
$name=null;
if (isset($fname) and ! empty($fname)) { $name .= $fname; }
if (isset($lname) and ! empty($lname)) {
// if no $fname, it will be NULL
if ($name) { $name .= ' '; }
$name .= $lname;
}
$from = (isset($name))?'"' .$name . '" <' . $email . '>':$email;
// Build your headers, if no from it will come from "nobody", the default Apache user (I think), then
if ($from) { $headers = "From: $from\n"; }