You need to build your header and include that in your mail() call:

 $lc_headers  = "From: $lc_from_name <$lc_from_email>\n";
 $lc_headers .= "X-Sender: <$lc_sender>\n";
 $lc_headers .= "X-Mailer: PHP\n"; // mailer
 $lc_headers .= "Return-Path: <$lc_return>\n";  // Return path for errors
 $lc_headers .= "Mime-Version: 1.0\n";

 mail($lc_recipient, $lc_subject, $lc_message, $lc_headers);


----- Original Message -----
From: "Andre Dubuc" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Saturday, October 26, 2002 1:40 PM
Subject: [PHP] Getting the "From: [EMAIL PROTECTED]" to work


> 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
> Xsite.com
> To complete your registration, please click the 'Confirmation' URL below.
> https://www.Xsite.com/all-confirm.php?unique_id={$_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,
> Tia,
> Andre
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
>



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to