r-it Posted March 27, 2007 Share Posted March 27, 2007 $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. Link to comment https://forums.phpfreaks.com/topic/44455-solved-i-just-dont-know-what-im-doing-wrong-with-this-mail-script/ Share on other sites More sharing options...
NSW42 Posted March 27, 2007 Share Posted March 27, 2007 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); Link to comment https://forums.phpfreaks.com/topic/44455-solved-i-just-dont-know-what-im-doing-wrong-with-this-mail-script/#findComment-215886 Share on other sites More sharing options...
r-it Posted March 27, 2007 Author Share Posted March 27, 2007 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. Link to comment https://forums.phpfreaks.com/topic/44455-solved-i-just-dont-know-what-im-doing-wrong-with-this-mail-script/#findComment-215887 Share on other sites More sharing options...
NSW42 Posted March 27, 2007 Share Posted March 27, 2007 make sure the hosting site has the php mailer enabled, if they havent they may be using there smtp server for sending mail out. Link to comment https://forums.phpfreaks.com/topic/44455-solved-i-just-dont-know-what-im-doing-wrong-with-this-mail-script/#findComment-215888 Share on other sites More sharing options...
r-it Posted March 27, 2007 Author Share Posted March 27, 2007 it does, is there anything wrong with my headers perhaps? Link to comment https://forums.phpfreaks.com/topic/44455-solved-i-just-dont-know-what-im-doing-wrong-with-this-mail-script/#findComment-215915 Share on other sites More sharing options...
Wildhalf Posted March 27, 2007 Share Posted March 27, 2007 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); Link to comment https://forums.phpfreaks.com/topic/44455-solved-i-just-dont-know-what-im-doing-wrong-with-this-mail-script/#findComment-215921 Share on other sites More sharing options...
NSW42 Posted March 27, 2007 Share Posted March 27, 2007 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); Link to comment https://forums.phpfreaks.com/topic/44455-solved-i-just-dont-know-what-im-doing-wrong-with-this-mail-script/#findComment-215928 Share on other sites More sharing options...
r-it Posted March 27, 2007 Author Share Posted March 27, 2007 i just used a phpmailmime5 class for this and it worked, i dont know why the other one didnt work though, anyway, i'll regard this as being solved then Link to comment https://forums.phpfreaks.com/topic/44455-solved-i-just-dont-know-what-im-doing-wrong-with-this-mail-script/#findComment-215972 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.