Jump to content

[SOLVED] I just don't know what i'm doing wrong with this mail script


r-it

Recommended Posts

$to = $mail1;
	$subj = 'User registration';
	$messgage = "Dear $name $surname

	Thank you for your registration to something, please click on the link below to activate your account

	http://www.something.org/activate.php?log=$login&name=$name&surname=$surname&email=$email1&act=$key

	Regards
	US";
	$headers = 'From: [email protected]'."\r\n".
		'Reply-To: [email protected]'."\r\n".
		'X-Mailer: PHP/'.phpversion();

	mail($to, $subj, $message, $headers);

the thing is I've learnt a lot from these forums and i'm continually trying to improve my coding skills and it's been a while since i've used mail but i have a problem that its not sending the mail. I tested the values in the variables and they are there, i just don't know why its not sending.

 

the thing is I'm testing this thing for a client on our domain and therefore its in a sub folder in the root directory, but would the problem be in the default php version because my host uses php4 as the php default and i've just requested they change it to php5, but otherwise i'm in a cul-de-sac.

try this, you will find it works well

 

$from = "From: whoever@domain";

$subject = "User registration";

$message = "Hi there,\n".

"Thank you for your registration to something.\n".

"please click on the link below to activate your account.\n\n".

"$siteurl/validate.php?vc=$valid\n\n".

"You can then login.";

 

mail($email_address,$subject,$message,$from);

i used that before but the problem is that with that one, a lot of people said they were not receiving my mails, only to find that it was rendered as spam, as there were no headers, but i really don't understand now what's happening.

Use the following it works for me with headers and all...

 

You may have to change the header slightly for your own email....

 

 

// Let's mail the Autoresponder!
   $subject = "$firstname, E-Z-M Login Details";
    $message = "Hi $firstname,

Thank you for joining E-Z-M.

Here is your Login details,
User Name : $email
Password  : $password

To Your Success!

E-Z-M Admin
";
$femail = "From: $firstname<$email>";
$remail = "Reply-To: $firstname<$email>";
    $headers = $femail  . "\r\n" .
    $remail . "\r\n" .
   'X-Mailer: PHP/' . phpversion();

   mail('$email', $subject, $message, $headers);

give this one a try and you should be in business

 

            $emailfrom = "me";

$emailaddr = "[email protected]'";

 

$headers .= "From: $emailfrom <$emailaddr>\n";

$headers .= "Reply-To: $emailfrom <$emailaddr>\n";

$headers .= "Return-Path: $emailfrom <$emailaddr>\n";

$headers .= "Message-ID: <".time()." WelcEm@".$_SERVER['SERVER_NAME'].">\n";

$headers .= "X-Mailer: PHP v".phpversion()."\n";

 

$subject = "Welcome!";

$body = $user.",\n\n"

."Thank you for your registration to something. "

."please click on the link below to  "

."activate your account "

."visiting the following URL:\n\n"

."http://www.something.org/activate.php\n"

."You can then login and use the site.\n\n"

."-- Admin";

 

$result = mail($email,$subject,$body,$headers);

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.