Conjurer Posted May 12, 2008 Share Posted May 12, 2008 I have some code set up to mail out a reset password. For testing mode I want to add a blind copy to myself but am not sure how to add that to the script. Here is the guts of the existing code: /*I connected successfully and an email address exists in the mysql database so now I fetch it.*/ $row = $result->fetch_object(); $email = $row->email; /* Sets variable equal to the email */ $from = "From: support@XYZ.com \r\n"; $mesg = "Your password for the XYZ Member directory has been changed. \r\n" ."You can login to the membership directory at http://www.XYZ.com/Directory/index.php5 \r\n\r\n" ."Your username is: $username \r\n" ."Your new password is: $password\r\n\r\n" ."You can either keep this password or change it to one you preferr the next time you log in. " ."To change it, once you log in click on the \"Change Password\" button.\r\n"; /* so here is where I put the email together from the variables. How can I hard code a blind copy into the if statement behind the $email variable? */ if (mail($email, 'XYZ login information', $mesg, $from)) { echo "Your new password has been e-mailed to you at $email.<br />"; echo "If you no longer have access to the $email e-mail account, please contact our webmaster at info@XYZ.com for assistance.<br />"; return true; } Quote Link to comment Share on other sites More sharing options...
Cory94bailly Posted May 12, 2008 Share Posted May 12, 2008 That would be a header... I forgot the code for it but I know it's a header Quote Link to comment Share on other sites More sharing options...
Conjurer Posted May 12, 2008 Author Share Posted May 12, 2008 Yeah I am really looking for the code :-) Quote Link to comment Share on other sites More sharing options...
Cory94bailly Posted May 12, 2008 Share Posted May 12, 2008 Yeah I am really looking for the code :-) http://www.w3schools.com/PHP/php_mail.asp Try a dry run and do this: mail(to,subject,message,Bbc:EMAILSHERE) I'm not 100% sure that will work but it's worth a try Quote Link to comment Share on other sites More sharing options...
LooieENG Posted May 12, 2008 Share Posted May 12, 2008 <?php /*I connected successfully and an email address exists in the mysql database so now I fetch it.*/ $row = $result->fetch_object(); $email = $row->email; /* Sets variable equal to the email */ $from = "From: support@XYZ.com \r\n" . "Bcc: webmaster@example.com \r\n"; $mesg = "Your password for the XYZ Member directory has been changed. \r\n" ."You can login to the membership directory at http://www.XYZ.com/Directory/index.php5 \r\n\r\n" ."Your username is: $username \r\n" ."Your new password is: $password\r\n\r\n" ."You can either keep this password or change it to one you preferr the next time you log in. " ."To change it, once you log in click on the \"Change Password\" button.\r\n"; /* so here is where I put the email together from the variables. How can I hard code a blind copy into the if statement behind the $email variable? */ if (mail($email, 'XYZ login information', $mesg, $from)) { echo "Your new password has been e-mailed to you at $email.<br />"; echo "If you no longer have access to the $email e-mail account, please contact our webmaster at info@XYZ.com for assistance.<br />"; return true; } ?> Try that Quote Link to comment Share on other sites More sharing options...
Conjurer Posted May 12, 2008 Author Share Posted May 12, 2008 Sweetness! Thank you - that is working!!! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.