Jump to content

php mail function :(


andrew_biggart

Recommended Posts

Im trying to set up a verifying registration system and i know that its working properly apart from, it doesnt send the email to the user with the confirmation link so i guess it doesnt work fully lol.

 

registration page.htm ..

	<form method="post" action="user_register_submit.php">	
<table class="profileforum">
<tr><td class="forum1">
<table>
<tr><td class="reg_headers">Username :</td><td class="maxleft">

		<input name="Username" id="Username" type="text" maxlength="16 "value="Make your own up" /> 
		Max 16 characters
	</td></tr>
<tr><td class="reg_headers">Password :</td><td class="maxleft">
		<input name="Password" id="Password" type="password" maxlength="8" /> Max 8 characters</td></tr>
<tr><td class="reg_headers">Email address :</td><td>

		<input name="Email" id="Email" type="text" value="Must be valid" />
	</td></tr>	
</table>
</td></tr>
</table>
<br />
<table class="profileforum">
<tr><td class="forum1">
<table>
<tr><td class="reg_headers">Location :</td><td>
	<input name="Location" id="Location" type="text" value="Where your from" /></td></tr>
<tr><td class="reg_headers">Favourite Smoking method :</td><td>
	<select name="Fav" id="Fav"style="width: 126px">
	<option>Choose</option>
	<option>Joint</option>
	<option>Blunt</option>
	<option>Tulip</option>
	<option>Bong</option>
	<option>Lung</option>
	<option>Bucket</option>
	</select></td></tr>
<tr><td class="reg_headers">Favourite quote :</td><td class="maxleft">
	<input name="Quote" id="Quote"type="text" style="width: 246px" maxlength="50 "value="Words of wisdom" /> 
	Max 50 characters</td>

</tr>
<tr><td class="reg_headers" style="width: 200px" valign="top">About me : </td><td>
		<textarea name="Aboutme" id="Aboutme" style="width: 415px; height: 135px" >Write a little about yourself</textarea>
	</td></tr>
	<tr><td class="reg_headers" style="width: 200px" valign="top">Why do you 
		love weed? : </td><td>
		<textarea name="Whywe" id="Whywe" style="width: 415px; height: 135px" >Give a short reason why you love weed so others can read it on your profile</textarea>
	</td></tr>

</table>
</td></tr>
</table>
<br />
<table class="profileforum">
<tr><td class="forum1">
<table>
<tr><td class="reg_headers">Interests :</td><td class="maxleft">
	<input name="Interests" id="Interests" type="text" style="width: 246px" /> 
	Max 50 characters</td></tr>
<tr><td class="reg_headers">What makes you happy? :</td><td class="maxleft">
	<input name="Happy" id="Happy"type="text" style="width: 246px" /> 
	Max 70 characters</td></tr>
<tr><td class="reg_headers">What makes you sad? :</td><td class="maxleft">
	<input name="Sad" id="Sad"type="text" style="width: 246px" /> 
	Max 70 characters</td>
</tr>
<tr><td class="reg_headers" style="width: 200px" valign="top">Bad habits : </td><td class="maxleft">
	<input name="Habits" id="Habits"type="text" style="width: 246px" /> 
		Max 60 characters
	</td></tr>
</table>
</td></tr>
</table>
<br />
<table class="profileforum">
<tr><td class="forum1">
<table>
<tr><td class="reg_headers">Music :</td><td class="maxleft">
	 <select id="Music"name="Music" style="width: 126px">
	<option>Choose</option>
	<option>Dance</option>
	<option>RnB</option>
	<option>Funky House</option>
	<option>Indie</option>
	<option>Rock</option>
	<option>Electro</option>
	<option>Chillout</option>
	</select></td></tr>
<tr><td class="reg_headers">Movie :</td><td class="maxleft">
	<input name="Movie" id="Movie"type="text" style="width: 246px" /> 
	Max 100 characters</td></tr>
<tr><td class="Website">Website :</td><td class="maxleft">
	<input name="Website" id="Website"type="text" style="width: 246px" /> 
	No spamming</td>
</tr>
</table>
</td></tr>
</table>
<br />
<table class="profileforum">
<tr><td class="forum1">
<table>
<tr><td class="reg_headers">Update your status : </td><td>
		<input name="regstatus"type="text"  maxlength="50" style="width: 419px" value="What are you doing right now?" />
	</td></tr>
	<tr><td class="maxright">Max 50 characters     </td></tr>
<tr><td>


	</td><td class="style1"> </td></tr>

</table>
<table>
<tr><td class="reg_headers">Upload a profile picture : </td><td>
		<input name="File1" type="file" style="width: 248px" />
	</td></tr>
	<tr><td class="maxright">Max size 100px X 100px   </td></tr>


</table>

</td></tr>
</table>
<br />
<br />
<table class="profileforum">
<tr><td class="forum1">
<table>
<tr><td class="terms"><h1 class="subcats">Terms & Conditions</h1>
	I hereby solemnly declare that once I have received my keys to the 
	weloveweed mansion I will not act like a demented retard, cock slurping, 
	member abusing, page spamming 
	slut. I will respect my new online home as if I was in my own home. I 
	will not post shit all over the walls, abuse or bully my family members 
	or leave 
	porn, and useless links lying around everywhere.<br />
	<br />
	I declare that I will try my best to donate new content to the site and upload as much 
	cool things as I come across while browsing the web. <br />
	<br />
	And most of all I agree to enjoy this site to its full extent, have as 
	much fun as possible and treat it like my own!<br />
	<br />
	<br />
	<h1 class="subcats">Important Information</h1>
	By Clicking the box below and submitting your details means that you 
	agree to our <a href="terms_conditions.htm">Terms & Conditions</a><h1 class="accept">
	<input type="checkbox" style="width:16px;" onclick="if(this.checked==1)document.getElementById('register').disabled='';else document.getElementById('register').disabled='disabled';" 
value="" name="accept" />Accept that shit !</h1>
</td></tr>
</table>
</td></tr>
</table>
<br />
<table class="profileforum">
<tr><td class="forum1">
<table>
<tr><td class="style1"><input name="regreset" type="reset" value="D'oh" />
<input id="register" name="register" type="submit" value="Join the mansion" disabled="disabled" />
</td></tr>
</table>
</td></tr>
</table>

<br />
<br />
</form>

 

This all works fine.

 

Registration page .php

 

<?php

   include("config_members_temp.php");
   
   $confirm_code=md5(uniqid(rand()));
   
   $Username = ($_POST['Username']);
   $Password = ($_POST['Password']);
   $Email = ($_POST['Email']);
   $Location = ($_POST['Location']);
   $Fav = ($_POST['Fav']);
   $Quote = ($_POST['Quote']);
   $Interests = ($_POST['Interests']);
   $Happy = ($_POST['Happy']);
   $Sad = ($_POST['Sad']);
   $Habits = ($_POST['Habits']);
   $Music = ($_POST['Music']);
   $Movie = ($_POST['Movie']);
   $Website = ($_POST['Website']);
   $Aboutme = ($_POST['Aboutme']);
   $Whywe = ($_POST['Whywe']);


   $sql = "INSERT INTO Temp_Users ( Username, Password, Email, Location, Fav, Quote, Interests, Happy, Sad, Habits, Music, Movie, Website, Aboutme, Whywe, Confirm_code) VALUES( '$Username','$Password', '$Email', '$Location', '$Fav', '$Quote', '$Interests', '$Happy', '$Sad', '$Habits' , '$Music', '$Movie', '$Website', '$Aboutme', '$Whywe', '$confirm_code' )";
   $result=mysql_query($sql) or die(mysql_error().": $sql");
     if($result){
// send e-mail to ...
$to=$Email;

// Your subject
$subject="www.weloveweed.co.uk | Your confirmation link!";

// From
$header="from: AdMiN <help@weloveweed.co.uk>";

// Your message
$message="Your Comfirmation link <3 from AdMiN \r\n";
$message.="Click on this link to activate your account \r\n";
$message.="http://server.microlite20.com/andrewbiggart.co.uk/weloveweed/Webpages/confirmation.php?passkey=$confirm_code";

// send email
$sentmail = mail($to,$subject,$message,$header);

}

// if not found
else {
echo "We have not found your email in our database";
}

// if your email succesfully sent
if($sentmail){
echo "Your confirmation link has been sent to your email address, you have to activate your account before you are able to login.";
}
else {
echo "Cannot send Confirmation link to your e-mail address, please make sure you have entered a valid email address and try again.";
}

   ?>

 

It doesnt send the email but it adds the information to the database including the confirmation code.

 

confirmation.php...............

 

	<?
include('config_members_temp.php');

// Passkey that got from link
$passkey=$_GET['passkey'];

$tbl_name1="Temp_Users";

// Retrieve data from table where row that match this passkey
$sql1="SELECT * FROM $tbl_name1 WHERE Confirm_code ='$passkey'";
$result1=mysql_query($sql1);

// If successfully queried
if($result1){

// Count how many row has this passkey
$count=mysql_num_rows($result1);

// if found this passkey in our database, retrieve data from table "temp_members_db"
if($count==1){

$rows=mysql_fetch_array($result1);
$name=$rows['name'];
    $Username = $rows['Username'];
    $Password = $rows['Password'];
    $Email = $rows['Email'];
    $Location = $rows['Location'];
    $Fav = $rows['Fav'];
    $Quote = $rows['Quote'];
    $Interests = $rows['Interests'];
    $Happy = $rows['Happy'];
    $Sad = ($_POST['Sad']);
    $Habits = $rows['Habits'];
    $Music = $rows['Music'];
    $Movie = $rows['Movie'];
    $Website = $rows['Website'];
    $Aboutme = $rows['Aboutme'];
    $Whywe = $rows['Whywe'];

$tbl_name2="User_infoT";

// Insert data that retrieves from "temp_members_db" into table "registered_members"
$sql2="INSERT INTO $tbl_name2 ( Username, Password, Email, Location, Fav, Quote, Interests, Happy, Sad, Habits, Music, Movie, Website, Aboutme, Whywe ) VALUES( '$Username','$Password', '$Email', '$Location', '$Fav', '$Quote', '$Interests', '$Happy', '$Sad', '$Habits' , '$Music', '$Movie', '$Website', '$Aboutme', '$Whywe' )";
$result2=mysql_query($sql2);
}

// if not found passkey, display message "Wrong Confirmation code"
else {
echo "Wrong Confirmation code";
}

// if successfully moved data from table"temp_members_db" to table "registered_members" displays message "Your account has been activated" and don't forget to delete confirmation code from table "temp_members_db"
if($result2){

echo "Welcome to weloveweed your account has been activated & you can log your ass in. <3 AdMiN ";

// Delete information of this user from table "temp_members_db" that has this passkey
$sql3="DELETE FROM $tbl_name1 WHERE confirm_code = '$passkey'";
$result3=mysql_query($sql3);

}

}
?>

 

and i know this bit works as i have manually entered the confirmation code in the address bar and it changes all the information to the permanant users table and removes all the old information from the tempery tabel so i guess.

 

Im trying to send the email to my hotmail account but it is just never getting received and it is not appearing in the junk section either.... What am i doing wrong?

 

Thanks for all your help in advance and ive tried to explain the problem to the best of my knowledge lol <3

Link to comment
Share on other sites

Try opening a gmail account and sending it to that. GMail is really laxed on mail rules.

 

My bet is that Hotmail is auto filtering it as spam and never "accepting" the message. This will most likely be the same for Yahoo and AOL.

 

The gist of it is, if they cannot verify the IP the mail was sent from has a valid MX record associated to that IP they do not accept the mail. You can try adding more headers to be more thorough, but 99% of the time that will not help given the prior issue I specified. As how to go about making the IP associated with your site a valid MX address, I do not have a clue. I have been trying to figure that out for sometime for my own mail server :)

 

Try adding on more thorough headers and maybe even adding "-fhelp@weloveweed.co.uk" to it, see mail (the mail function) for more information on how to go about adding more headers properly etc.

Link to comment
Share on other sites

il have a look at that cheers!!

 

its so annoying lol

 

Yep, the shit kicker part is, spam servers know this and set it up that way. This only filters out small servers that are legit, at least imo. It would be nice if they had a deal where you could verify the legitimacy of your server to be allowed and have a probationary period before getting on the "A" list, but oh well.

Link to comment
Share on other sites

Yea man fucking psammers and scammers are spoiling it for everyone grrrrrrrrrrrrrr.

 

I dotn really understand this header shit man, where do i put them etc  ??

 

i tryed it with my uni email address and it send and confirmed no problem, but i need my users to be able to use any email address to register toerwise there is no point on having a registration page to be honest aghhhhhhhhhhhhhhhhh lol

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.