PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
<?php
$uid=uniqid(microtime(),1); // make a unique id
session_start(); // start a session
$SESSION['uid']=$uid; // set the uid for the session and validation code
$done=$_GET['done']; $user=$_GET['un']; $email==$_GET['email']; $pass==$_GET['pass']; $puid==$_GET['puid'];
if(isset($done)&&($done='test')){ // send the mail
$to="$email"; $subject='test of e-mail genereation'; $bcc1='removed my e-mail address from this spot';
$header="bcc: $bcc1"; $body="sorry if you got this in err. i hope those that help me test it don't enter random e-mail addresses or use it to spam. this is simply a test of php's e-mail ability. i am testing to see if i have it working right. if you got this in err, alert me by fwding it to 'removed my e-mail address from this spot'. thanx.
if not in err, then let me know if the following is what you entered:
for a name: $user
for a pass: $pass
and your assigned "validation code" would be: $puid
ask me about the validation code. i should be logging it
-josh";
mail($to, $subject, $body, $header);
?><html><head><title>test</title></head><body><p>thanx for using the test. hit back to go back and test again</p></body></html><?php
}else{ // make the form
?><html><head><title>test of e-mail</title></head>
<body><center><p>testing of e-mail ability of php</p>
<form name="emailtest" method="GET" <?php echo "action="$_SERVER[PHP_SELF]""; ?> >
<input type="hidden" name="puid" <?php echo "value="$uid""; ?> >
<input type="hidden" name="done" value="test">
<table><tr><td>name</td><td><input type="text" name="un"></td></tr>
<tr><td>email</td><td><input type="test" name="email"></td></tr>
<tr><td>pass</td><td><input type="password" name="pass"></td></tr>
<tr><td><input type="submit" value="test me!"></td><td><input type="reset" value="clear me!"></td></tr>
</table></form></center></body></html><?php
}
?>
note: i used get here because i wanted to see the output in the first variation to make sure it matched what was sent, and want to be aable to test it in this one as well.
i plan on making another variation of the test file using post once bcc works, and then taking the e-mail sending section and inserting it into the sign uphaving the unique id provided by that function as a validation code, and later to prevent multiple submissions of each step of the sign up
You should be using assignment (single-equals, '=') not equality testing (double-equals, '==') when assigning values out of the $_GET array. But I don't think that's the problem.
Is any mail being sent? Are the to-recipients receiving mail, just not the bcc'd ones?
nielsene wrote:You should be using assignment (single-equals, '=') not equality testing (double-equals, '==') when assigning values out of the $_GET array. But I don't think that's the problem.
Is any mail being sent? Are the to-recipients receiving mail, just not the bcc'd ones?
thanx. i just fixed that.
but that was NOT the issue. the issue was and still is the fact it's not using the header.
apparently the issue is different than i thought....
me: i made a php script do test the mail function
me: doesn't work right
me: it's not doing bcc
friend: ok
me: http://people.brandeis.edu/~m3rajk/JMT/ ... c-try3.php
me: tell me what you think of the validation code
friend: ?
me: did you send it to yourself?
friend: yeah
friend: why?
me: did you get the e-mail yet?
friend: no
me: hmpf
me: it sent it to me.. it's suppossed to sent it to what YOU wrote in.
me: which means it is ONLY sending tot he bcc
i assume this means i just replace $to with $email in the call and it should work, and for some reason the setting of $to isntt working right. i'll have it checked and report back
d-try4.php (c-try3, the one in the im convo is the same withthe exception that $to is used in place of $email in the mail call). try 4 is sending to my friend that's testing it, but not to me. so now the bcc really isn't working.
<?php
$uid=uniqid(microtime(),1); // make a unique id
session_start(); // start a session
$SESSION['uid']=$uid; // set the uid for the session and validation code
$done=$_POST['done']; $user=$_POST['un']; $email=$_POST['email']; $pass=$_POST['pass']; $puid=$_POST['puid'];
if(isset($done)&&($done='test')){ // send the mail
$to="$email"; $subject='test of e-mail genereation'; $bcc1='removed my e-mail address from this spot';
$header="bcc: $bcc1"; $body="sorry if you got this in err. i hope those that help me test it don't enter random e-mail addresses or use it to spam. this is simply a test of php's e-mail ability. i am testing to see if i have it working right. if you got this in err, alert me by fwding it to 'removed my e-mail address from this spot'. thanx.
if not in err, then let me know if the following is what you entered:
for a name: $user
for a pass: $pass
and your assigned "validation code" would be: $puid
ask me about the validation code. i should be logging it
-josh";
mail($email, $subject, $body, $header);
?><html><head><title>test</title></head><body><p>thanx for using the test. hit back to go back and test again</p></body></html><?php
}else{ // make the form
?><html><head><title>test of e-mail</title></head>
<body><center><p>testing of e-mail ability of php</p>
<form name="emailtest" method="POST" <?php echo "action="$_SERVER[PHP_SELF]""; ?> >
<input type="hidden" name="puid" <?php echo "value="$uid""; ?> >
<input type="hidden" name="done" value="test">
<table><tr><td>name</td><td><input type="text" name="un"></td></tr>
<tr><td>email</td><td><input type="test" name="email"></td></tr>
<tr><td>pass</td><td><input type="password" name="pass"></td></tr>
<tr><td><input type="submit" value="test me!"></td><td><input type="reset" value="clear me!"></td></tr>
</table></form></center></body></html><?php
}
?>
I seem to remeber reading some where that it the BCC function is only avialable in php after version 4.2 I think. I tried to find the article agian so you might want to do a bit of research on it to find out about it.
I know that it is an issue on one of the servers I use because they are running a old version of php and it doesn't support the bcc header.