Jump to content

Problem with mail().. ehh maybe i dont really know..


AbydosGater

Recommended Posts

Hi,
Ive been setting up my registration system for my site.. blah blah most of you have heard it all before, yet another question from this guy you say :P...

When the user registers, it sends them an email...

[code]
<?php
$username = $_POST['username'];
$password = $_POST['password'];
$enpassword = md5($password);
$email = $_POST['email'];
$acode = rand(1000000, 9999999);
$datestamp = DATESTAMP;
$ipaddress = $_POST['ipaddress'];
$headers  = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
mysql_query("INSERT INTO sf_users (member_id, username, password, email, rank, CL, banned, active, activation_code, registration_date) VALUES (NULL , '$username', '$enpassword', '$email', 'Ensign', '0', '0', '0', '$acode', '$datestamp')") or die(mysql_error());
$member_id = mysql_insert_id();
mysql_query("INSERT INTO sf_usedips (ip_id, ip_address) VALUES(NULL, '$ipaddress')") or die(mysql_error());
mail($email, "Shadow Fleet Registration", "$registration_email_user", "$headers");

?>
[/code]

This is just a section of my code, See the $registration_email_user is the message to send the email...
Thats saved in vars as follows...

[qoute]
$registration_email_user = "
<html>
<p><b>Shadow Fleet Registration.</b></p>
<p>Thank you, for registering with Shadow Fleet, you have completed step one of
  your registration process.<br>
  You have registered your account with the following information...</p>
<p>Username: $username<br>
  Password: $password<br>
  Email Address: $email<br>
  Activation Code: $acode<br>
  Member Id: $member_id<br>
  <br>
  You must keep your password safe, it has been encrypted in our database and
  cannot be retrieved.<br>
  <br>
  You registered with the following IP address: $ipaddress<br>
  Your IP has been logged in our system, and has been stopped from registering
  multiple accounts.<br>
  If you think your IP should be allowed to register another
  account please contact a member of the Admin team.</p>
<p>Your account is not yet completely active,<br>
  To activate your account please click the link below.</p>
<p>http://shadowfleet.info/newversion/register.php?step=3&&uid=$member_id&&acode=$acode</p>
<p>Thank you,<br>
  Shadow Fleet Administrations Team.</p>
</html>
";

[/quote]

Its all working, inserting ALL the information for the user,
But when it sends the email.. Its sending everything fine, except for the member_id and $acode...

I know they both work because i am echoing the member_id after they register.. And the $acode is inserted to the database fine..
But in the email the member_id and acode vars arnt displaying, they do exist..

I have no idea why the are not showing..
Anyone help?
why dont you change your email variable to have something like <#member_id#> instead of $member_id and the same with $acode.

then add another part above the mail() function that looks like this:
[code=php:0]
$registration_email_user = str_replace("<#member_id#>", $member_id, $registration_email_user);
$registration_email_user = str_replace("<#acode#>", $acode, $registration_email_user);
[/code]

because that would work aswell.
[/code]
just a few notes, its the variables i am sending in the form that are showing in the email.. the ones i set in the script just before the mail.. are not getting to the email, i can echo them so theyre set.. and i have even tryed setting a $test and sticking it to the end of the email...

and i got nothing.. somethings wrong..

Anyone any ideas?

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.