RE: [PHP] Getting the From: admin@site.com to work
[snip] if(@mail($to, $from, $subject, $message)) Go back to the manual. The parameters for mail are mail(to,subject,message,headers). You have to pass the From: address in the headers. $to = [EMAIL PROTECTED]; $subject = Your email; $message = Your email is good; $headers = From: [EMAIL PROTECTED]\r\n; mail($to,$subject,$message,$headers); Read the manual on other headers you can send. ---John Holmes... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Getting the From: admin@site.com to work
http://www.php.net/manual/en/function.mail.php if(@mail($to, $from, $subject, $message)) There is no 'from' field. This must be put in the headers. Andre Dubuc wrote: Perhaps some kind guru can spare me some time. I've tried to get the From: 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
Re: [PHP] Getting the From: admin@site.com to work
Thanks John, I had the maual in front of me, but I didn't understand that you had to put the 'From:' stuff in a 'header'. That's why it wasn't working. I presumed (wrongly again) that 'headers' were optional, and I got sidetracked by the success of the To: field. Thanks for clearing that up. Regards, Andre On Saturday 26 October 2002 04:42 pm, John W. Holmes wrote: [snip] if(@mail($to, $from, $subject, $message)) Go back to the manual. The parameters for mail are mail(to,subject,message,headers). You have to pass the From: address in the headers. $to = [EMAIL PROTECTED]; $subject = Your email; $message = Your email is good; $headers = From: [EMAIL PROTECTED]\r\n; mail($to,$subject,$message,$headers); Read the manual on other headers you can send. ---John Holmes... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Getting the From: admin@site.com to work
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: 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
Re: [PHP] Getting the From: admin@site.com to work
Add this to the header string... Bcc: [EMAIL PROTECTED]\r\n; Andre Dubuc wrote: Perhaps some kind guru can spare me some time. I've tried to get the From: 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