Re: Getting the "From: admin@site.com" to work
| From: | John Nichel | Date: | Sat, 26 Oct 2002 20:45:39 +0000 |
| Subject: | Re: Getting the "From: admin@site.com" to work | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-121548@lists.php.net to get a copy of this message | ||
http://www.php.net/manual/en/function.mail.php
There is no 'from' field. This must be put in the headers. Andre Dubuc wrote:if(@mail($to, $from, $subject, $message))
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 = "admin@Xsite.com"; $_SESSION['from_name'] = "".$reg_first." <".$reg_last.">"; */ /* Begin Confirmation Required script */ .... other code /* Begin MAIL() */ $to = $_SESSION['name_mail']; $from = "admin@Xsite.com"; /* 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