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: [email protected] \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 [email protected] for assistance.<br />"; return true; } Link to comment https://forums.phpfreaks.com/topic/105203-solved-how-do-i-add-a-blind-copy-to-an-email-script/ 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 Link to comment https://forums.phpfreaks.com/topic/105203-solved-how-do-i-add-a-blind-copy-to-an-email-script/#findComment-538690 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 :-) Link to comment https://forums.phpfreaks.com/topic/105203-solved-how-do-i-add-a-blind-copy-to-an-email-script/#findComment-538691 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 Link to comment https://forums.phpfreaks.com/topic/105203-solved-how-do-i-add-a-blind-copy-to-an-email-script/#findComment-538694 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: [email protected] \r\n" . "Bcc: [email protected] \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 [email protected] for assistance.<br />"; return true; } ?> Try that Link to comment https://forums.phpfreaks.com/topic/105203-solved-how-do-i-add-a-blind-copy-to-an-email-script/#findComment-538696 Share on other sites More sharing options...
Conjurer Posted May 12, 2008 Author Share Posted May 12, 2008 Sweetness! Thank you - that is working!!! Link to comment https://forums.phpfreaks.com/topic/105203-solved-how-do-i-add-a-blind-copy-to-an-email-script/#findComment-538707 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.