Nicholas Posted September 21, 2012 Author Share Posted September 21, 2012 Last Attempt from me: if($them['email'] != '') { ?> <h3>Continuing Account Setup: What is your email address?</h3> <form action="prefs.php?act=AccountSetup&continue=1" method="post"> <input type="text" name="email" /> <input type="submit" value="Confirm" /> </form> <?php } if(isset($_GET['continue']) && $_GET['continue'] == 1) { $check = mysql_query('SELECT `email` FROM `players` WHERE `email` = "'.mysql_real_escape_string($_POST['email']).'"'); if(mysql_num_rows($check)) { ?> <div style="color: red;" align="center"> Email already in use. Choose another one.<br /> <form action="prefs.php?act=AccountSetup" method="post"> <input type="submit" value="Continue" /> </form> </div> <?php exit($h->endpage()); } $code = mt_rand(1000000000, 9000000000); $to = $_POST['email']; $subject = 'Email Activator'; $from = 'Criminals Nightmare - No Reply<[email protected]>'; $headers = 'MIME-Version: 1.0rn'; $headers.= '\r\nContent-type: text/html; charset=utf8'; $headers.= 'From: '.$from.'\r\n'; $message = <<<EOF <html> <head> <title>Criminals Nightmare Account Activation</title> </head> <body bgcolor="#999" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0"> <center> <table width="600" cellpadding="0" cellspacing="0" border="0"> <tr> <td colspan="5" align="left" bgcolor="#999" style="font-size: 10px;">***Learn more about the latest specials for Criminals Nightmare.</td> <td colspan="3" align="right" bgcolor="#999" style="font-size: 10px;"></td> </tr> <tr> <td colspan="8"><img src="http://criminals-nightmare.com/mesi/topimage.jpg" width="600" height="135" alt="Criminals Nightmare" style="display: block;" /></td> </tr> <tr> <td bgcolor="#999" color="#323232" style="margin: 3px;"> <center> <a href="_blank" href="http://www.criminals-nightmare.com/login.php" style="color: #373737;"><strong><h3>LOGIN HERE</h3></strong></a> __________________________________________________________________________________________<br /> Your code to activate your account is: <strong>{$code}</strong><br /> Enter this code inside the game on Account Setup. __________________________________________________________________________________________ </center> </td> </tr> </table> </center> </body> </html> EOF; if(mail($to, $subject, $message, $headers)) { ?> Email has been sent to "<?php echo $_POST['email']; ?>" with a code.<br /> <form action="prefs.php?act=AccountSetup" method="post"> <input type="submit" value="Enter Code" /> </form> <?php } else { echo 'Email could not be sent.'; } } post up any errors and shall help you fix them :) Also, you DONT need to have the account setup on your server. You can have [email protected] and it WILL work. Alternatively, you can use: http://sourceforge.net/projects/phpmailer/ ok, i edited part this as some of the info was wrong to my setup but nothing serious. but it still isn't sending the email to my hotmail inbox or junk folder? i really am confused why this isn't working :s Quote Link to comment Share on other sites More sharing options...
rulerofzu Posted September 21, 2012 Share Posted September 21, 2012 (edited) So go back to basics and see if it is something wrong on your server Create a test.php page put in your hotmail in the $to <?php $to = "[email protected]"; $subject = "Test mail"; $message = "Hello! This is a simple email message."; $from = "[email protected]"; $headers = "From:" . $from; mail($to,$subject,$message,$headers); echo "Mail Sent."; ?> I would also check with a phpinfo file that mail is actually enabled Edited September 21, 2012 by rulerofzu Quote Link to comment Share on other sites More sharing options...
Nicholas Posted September 21, 2012 Author Share Posted September 21, 2012 (edited) So go back to basics and see if it is something wrong on your server Create a test.php page put in your hotmail in the $to <?php $to = "[email protected]"; $subject = "Test mail"; $message = "Hello! This is a simple email message."; $from = "[email protected]"; $headers = "From:" . $from; mail($to,$subject,$message,$headers); echo "Mail Sent."; ?> I would also check with a phpinfo file that mail is actually enabled ok i tried that <?php include_once (DIRNAME(__FILE__) . '/mains/info.php'); $to = "[email protected]"; $subject = "Test mail"; $message = "Hello! This is a simple email message."; $from = "[email protected]"; $headers = "From:" . $from; mail($to,$subject,$message,$headers); echo "Mail Sent."; exit($end->page()); ?> still doesn't send the email, so do you think it is the server? EDIT: not sure if these details are correct but i think this is my PHP info stuff? ----------------------------------------------------- CORE ----------------------------------------------------- Directive: mail.add_x_header Local Value: off Master Value: off Directive: mail.force_extra_parameters Local Value: no value Master Value: no value Directive: mail.log Local Value: no value Master Value: no value Directive: sendmail_from Local Value: no value Master Value: no value ---------------------------------------------------- they are all the information i could find by using <?php phpinfo(); ?> in a file? Edited September 21, 2012 by Nicholas Quote Link to comment Share on other sites More sharing options...
rulerofzu Posted September 21, 2012 Share Posted September 21, 2012 What is the following PHP Version OS windows or *nix Look at the sendmail path in the core. Also try the following if ( function_exists( 'mail' ) ) { echo 'mail() is available'; } else { echo 'mail() has been disabled'; } Quote Link to comment Share on other sites More sharing options...
Nicholas Posted September 21, 2012 Author Share Posted September 21, 2012 (edited) What is the following PHP Version OS windows or *nix Look at the sendmail path in the core. Also try the following if ( function_exists( 'mail' ) ) { echo 'mail() is available'; } else { echo 'mail() has been disabled'; } PHP Version 5.3.13 think OS windows is Linux i put that in and it says "mail() is avaliable" Edited September 21, 2012 by Nicholas Quote Link to comment Share on other sites More sharing options...
rulerofzu Posted September 21, 2012 Share Posted September 21, 2012 ok so try that test again but now use my email [email protected] Ill let you know if i get it. Quote Link to comment Share on other sites More sharing options...
Nicholas Posted September 21, 2012 Author Share Posted September 21, 2012 ok so try that test again but now use my email [email protected] Ill let you know if i get it. mail sent. Quote Link to comment Share on other sites More sharing options...
rulerofzu Posted September 21, 2012 Share Posted September 21, 2012 Received. So if your not getting that to a hotmail account then its a hotmail issue probably look at white list / spf I believe hotmail/microsoft still do a register to avoid mail getting junked or not getting there at all. Quote Link to comment Share on other sites More sharing options...
Nicholas Posted September 21, 2012 Author Share Posted September 21, 2012 Received. So if your not getting that to a hotmail account then its a hotmail issue probably look at white list / spf I believe hotmail/microsoft still do a register to avoid mail getting junked or not getting there at all. Email has been sent to "[email protected]" with a code. did you get that message with the code? if you have, could you send me a quick print screen of it? Quote Link to comment Share on other sites More sharing options...
rulerofzu Posted September 21, 2012 Share Posted September 21, 2012 Ah yeah your next email is not correct. Its not being parsed as html instead your getting code <html> <head> <title>Criminals Nightmare Account Activation</title> </head> <body bgcolor="#999999" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0"> <center> <table width="600" cellpadding="0" cellspacing="0" border="0"> <tr> <td colspan="5" align="left" bgcolor="#999999" style="font-size: 10px;"> Learn more about the latest specials for Criminals Nightmare.</td> <td colspan="3" align="right" bgcolor="#999999" style="font-size: 10px;"></td> </tr> <tr> Quote Link to comment Share on other sites More sharing options...
Nicholas Posted September 21, 2012 Author Share Posted September 21, 2012 Ah yeah your next email is not correct. Its not being parsed as html instead your getting code <html> <head> <title>Criminals Nightmare Account Activation</title> </head> <body bgcolor="#999999" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0"> <center> <table width="600" cellpadding="0" cellspacing="0" border="0"> <tr> <td colspan="5" align="left" bgcolor="#999999" style="font-size: 10px;">***Learn more about the latest specials for Criminals Nightmare.</td> <td colspan="3" align="right" bgcolor="#999999" style="font-size: 10px;"></td> </tr> <tr> what about now? does it work properly now? Quote Link to comment Share on other sites More sharing options...
rulerofzu Posted September 21, 2012 Share Posted September 21, 2012 Nope still the same. Whats your code now? Quote Link to comment Share on other sites More sharing options...
Nicholas Posted September 21, 2012 Author Share Posted September 21, 2012 Nope still the same. Whats your code now? if(isset($_GET['continue']) && $_GET['continue'] == 1) { $check = mysql_query('SELECT `email` FROM `players` WHERE `email` = "'.mysql_real_escape_string($_POST['email']).'"'); if(mysql_num_rows($check)) { echo '<div style="color: red;" align="center"> Email already in use. Choose another one. <form action="prefs.php?act=AccountSetup" method="post"> <input type="submit" value="Continue" /> </form> </div>'; exit($end->page()); } $code = mt_rand(1000000000, 9000000000); $to = $_POST['email']; $subject = 'Email Activator'; $from = '[email protected]'; $headers = 'MIME-Version: 1.0rn'; $headers.= '\r\nContent-type: text/html; charset=utf8'; $headers.= 'From: '.$from.'\r\n'; $message = '<html> <head> <title>Criminals Nightmare Account Activation</title> </head> <body bgcolor="#999999" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0"> <center> <table width="600" cellpadding="0" cellspacing="0" border="0"> <tr> <td colspan="5" align="left" bgcolor="#999999" style="font-size: 10px;"> Learn more about the latest specials for Criminals Nightmare.</td> <td colspan="3" align="right" bgcolor="#999999" style="font-size: 10px;"></td> </tr> <tr> <td colspan="8"><img src="http://criminals-nightmare.com/mesi/topimage.jpg" width="600" height="135" alt="Criminals Nightmare" style="display: block;" /></td> </tr> <tr> <td bgcolor="#999999" color="#232323" style="margin: 3px;"> <center> <a href="_blank" href="http://www.criminals-nightmare.com/login.php" style="color: #373737;"><strong><h3>LOGIN HERE</h3></strong></a> _____________________________________________________________________________________ Your code to activate your account is: <strong>{$code}</strong> Enter this code inside the game on Account Setup. _____________________________________________________________________________________ </center> </td> </tr> </table> </center> </body> </html>'; if(mail($to, $subject, $message, $headers)) { mysql_query("INSERT INTO email_confirm VALUES ('$userid', '{$_POST['email']}', '$code', '0')"); echo 'Email has been sent to ('.mysql_real_escape_string($_POST['email']).') with a code. <form action="prefs.php?act=AccountSetup" method="post"> <input type="submit" value="Enter Code" /> </form>'; } else { echo 'Email could not be sent.'; } } Quote Link to comment Share on other sites More sharing options...
rulerofzu Posted September 21, 2012 Share Posted September 21, 2012 Try changing the headers $headers .= 'Content-Type: text/html; charset=utf-8\r\n'; Quote Link to comment Share on other sites More sharing options...
rulerofzu Posted September 21, 2012 Share Posted September 21, 2012 Also your mime is incorrect $headers='Mime-Version: 1.0\r\n'; Quote Link to comment Share on other sites More sharing options...
Nicholas Posted September 21, 2012 Author Share Posted September 21, 2012 ok, i changed what you said and i sent it you again, how does it look now? Quote Link to comment Share on other sites More sharing options...
rulerofzu Posted September 21, 2012 Share Posted September 21, 2012 Sorry my bad. $headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n"; Quote Link to comment Share on other sites More sharing options...
Nicholas Posted September 21, 2012 Author Share Posted September 21, 2012 Sorry my bad. $headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n"; changed, email sent again (sorry about this). is it working now? :) Quote Link to comment Share on other sites More sharing options...
rulerofzu Posted September 21, 2012 Share Posted September 21, 2012 Remove <head><title></head> just use <html><body.... Quote Link to comment Share on other sites More sharing options...
Nicholas Posted September 21, 2012 Author Share Posted September 21, 2012 Remove <head><title></head> just use <html><body.... done, email sent again :) Quote Link to comment Share on other sites More sharing options...
rulerofzu Posted September 21, 2012 Share Posted September 21, 2012 Hmmm well its working for me to a gmail account. Post your code now so i can compare to what I am using. Quote Link to comment Share on other sites More sharing options...
Nicholas Posted September 21, 2012 Author Share Posted September 21, 2012 (edited) Hmmm well its working for me to a gmail account. Post your code now so i can compare to what I am using. if(isset($_GET['continue']) && $_GET['continue'] == 1) { $check = mysql_query('SELECT `email` FROM `players` WHERE `email` = "'.mysql_real_escape_string($_POST['email']).'"'); if(mysql_num_rows($check)) { echo '<div style="color: red;" align="center"> Email already in use. Choose another one. <form action="prefs.php?act=AccountSetup" method="post"> <input type="submit" value="Continue" /> </form> </div>'; exit($end->page()); } $code = mt_rand(1000000000, 9000000000); $to = $_POST['email']; $subject = 'Email Activator'; $from = '[email protected]'; $headers = 'Mime-Version: 1.0\r\n'; $headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n"; $headers.= 'From: '.$from.'\r\n'; $message = '<html> <body bgcolor="#999999" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0"> <center> <table width="600" cellpadding="0" cellspacing="0" border="0"> <tr> <td colspan="5" align="left" bgcolor="#999999" style="font-size: 10px;"> Learn more about the latest specials for Criminals Nightmare.</td> <td colspan="3" align="right" bgcolor="#999999" style="font-size: 10px;"></td> </tr> <tr> <td colspan="8"><img src="http://criminals-nightmare.com/mesi/topimage.jpg" width="600" height="135" alt="Criminals Nightmare" style="display: block;" /></td> </tr> <tr> <td bgcolor="#999999" color="#232323" style="margin: 3px;"> <center> <a href="_blank" href="http://www.criminals-nightmare.com/login.php" style="color: #373737;"><strong><h3>LOGIN HERE</h3></strong></a> _____________________________________________________________________________________ Your code to activate your account is: <strong>{$code}</strong> Enter this code inside the game on Account Setup. _____________________________________________________________________________________ </center> </td> </tr> </table> </center> </body> </html>'; if(mail($to, $subject, $message, $headers)) { mysql_query("INSERT INTO email_confirm VALUES ('$userid', '{$_POST['email']}', '$code', '0')"); echo 'Email has been sent to ('.mysql_real_escape_string($_POST['email']).') with a code. <form action="prefs.php?act=AccountSetup" method="post"> <input type="submit" value="Enter Code" /> </form>'; } else { echo 'Email could not be sent.'; } } EDIT: can you post a print screen of what the email looks like if its working properly now? or does it still have problems? Edited September 21, 2012 by Nicholas Quote Link to comment Share on other sites More sharing options...
rulerofzu Posted September 21, 2012 Share Posted September 21, 2012 $to=filter_var($_POST['email'], FILTER_VALIDATE_EMAIL); $code=mt_rand(1000000000,900000000); $subject = 'Email Activator'; $from='[email protected]'; $headers = 'From: '.$from.''; $headers .= "MIME-Version: 1.0\r\n"; $headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n"; $message ='<html>'; $message = ' <body bgcolor="#999999" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0"> <center> <table width="600" cellpadding="0" cellspacing="0" border="0"> <tr> <td colspan="5" align="left" bgcolor="#999999" style="font-size: 10px;"> Learn more about the latest specials for Criminals Nightmare.</td> <td colspan="3" align="right" bgcolor="#999999" style="font-size: 10px;"></td> </tr> <tr> <td colspan="8"><img src="http://criminals-nightmare.com/mesi/topimage.jpg" width="600" height="135" alt="Criminals Nightmare" style="display: block;" /></td> </tr> <tr> <td bgcolor="#999999" color="#232323" style="margin: 3px;"> <center> <a href="_blank" href="http://www.criminals-nightmare.com/login.php" style="color: #373737;"><strong><h3>LOGIN HERE</h3></strong></a> __________________________________________________ ___________________________________ Your code to activate your account is: <strong>'.$code.'</strong> Enter this code inside the game on Account Setup. __________________________________________________ ___________________________________ </center> </td> </tr> </table> </center> </body> </html>'; mail($to, $subject, $message, $headers); echo "sent"; Quote Link to comment Share on other sites More sharing options...
rulerofzu Posted September 21, 2012 Share Posted September 21, 2012 Tested from my server to a gmail account all working correctly. Ill check back tomorrow to see if you have any further probs. Quote Link to comment Share on other sites More sharing options...
Nicholas Posted September 21, 2012 Author Share Posted September 21, 2012 ok, i done your version and sent you another mail? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.