Add this to the header string...


Andre Dubuc wrote:
Perhaps some kind guru can spare me some time. I've tried to get the "From: xxxx" field pre-filled for a registration/confirmation email that I send out.

I've managed to get the "To: ' field working great, but no matter where I stick the 'From:' code, it doesn't send the email. Any ideas what I'm doing wrong? Right now, the "From:' field is filled with my IP's address -- not exactly very cool to see!

Here's the code I've used (POP3):

$mail = $_SESSION['smail'];
$fname = $_SESSION['sfname'];
$sname = $_SESSION['ssname'];
$_SESSION['name_mail'] = "".$fname." ".$sname." <".$mail.">";

/* tried this -- it didn't work
$reg_first = "Registration";
$reg_last = "[EMAIL PROTECTED]";
$_SESSION['from_name'] = "".$reg_first." <".$reg_last.">";

/* Begin Confirmation Required script */

.... other code

/* Begin MAIL() */

$to = $_SESSION['name_mail'];
$from = "[EMAIL PROTECTED]"; /* I tried this head-on-direct approach -- no go, either */
$subject = "Please Confirm Your Registration";

$message = "Thank you for registering as a {$_SESSION['level']} at
To complete your registration, please click the 'Confirmation' URL below.{$_SESSION['unique_id']}";

if(@mail($to, $from, $subject, $message))


If I remove the $from everything works but with my IP's 'From: '
Where should the $from variable go in the mail() function?

Any hints or ideas gratefully appreciated,

PHP General Mailing List (
To unsubscribe, visit:

Reply via email to