aebstract Posted January 17, 2008 Share Posted January 17, 2008 Hi again, back so soon! I put a else die on the end of my connecting to DB.. so I am 99% sure that isn't my problem here. No information is being placed in the database and no email is being sent out. Any ideas on why not? <?php session_start(); header("Cache-control: private"); if (isset ($_POST['submit'])) { $problem = FALSE; if (empty ($_POST['plantloc'])) { $problem = TRUE; $error .= 'Must enter a plant location<br />'; } mysql_connect("*","*","*"); mysql_select_db("*"); if (!$problem) { $plantloc = $_POST['plantloc']; $length = 6; $password = ""; $possible = "0123456789bcdfghjkmnpqrstvwxyz"; $i = 0; while ($i < $length) { $char = substr($possible, mt_rand(0, strlen($possible)-1), 1); if (!strstr($password, $char)) { $password .= $char; $i++; } } $password2 = md5($_POST['password1']); $address = $_POST['address']; $result = MYSQL_QUERY("INSERT INTO plants (plantloc,password,address)". "VALUES ('$plantloc, '$password2', '$address,')"); $sendmail = " $password2 "; mail ('tcantwell@berryequipment.net', 'Thank You', $sendmail, 'From: aebstract@gmail.com'); } else { $content .= "$error"; } } ?> Quote Link to comment https://forums.phpfreaks.com/topic/86487-solved-info-not-going-to-db-email-not-sending/ Share on other sites More sharing options...
revraz Posted January 17, 2008 Share Posted January 17, 2008 Put a mysql_error after your Query $result = MYSQL_QUERY("INSERT INTO plants (plantloc,password,address)". "VALUES ('$plantloc, '$password2', '$address,')") or die (mysql_error()); It should reveal a error since you forgot a ' after $plantloc and you have a comma after $address Quote Link to comment https://forums.phpfreaks.com/topic/86487-solved-info-not-going-to-db-email-not-sending/#findComment-441925 Share on other sites More sharing options...
aebstract Posted January 17, 2008 Author Share Posted January 17, 2008 Correct about that part, got the information inserting now. How about the email not sending? It still isn't (if it seems to look correct, I'm gonna call up my provider and see if sendmail is activated). Quote Link to comment https://forums.phpfreaks.com/topic/86487-solved-info-not-going-to-db-email-not-sending/#findComment-441934 Share on other sites More sharing options...
revraz Posted January 17, 2008 Share Posted January 17, 2008 Your mail function and parameters look fine. Check your php.ini and see if the mail key looks right for SMTP for name and port. Check your log file for any errors that pertain to the mail function. Quote Link to comment https://forums.phpfreaks.com/topic/86487-solved-info-not-going-to-db-email-not-sending/#findComment-441936 Share on other sites More sharing options...
aebstract Posted January 17, 2008 Author Share Posted January 17, 2008 Alright I called in because I looked at my error log and had nothing dealing with mail in it. Couldn't find my php.ini file so he placed one in my html directory. I don't know anything about the php.ini file so I have no clue how to find what I need or check what it should be. He did a simple one line mail function test and said it was working so it may be my syntax? Quote Link to comment https://forums.phpfreaks.com/topic/86487-solved-info-not-going-to-db-email-not-sending/#findComment-441968 Share on other sites More sharing options...
revraz Posted January 17, 2008 Share Posted January 17, 2008 Have him give you that one line he did. Quote Link to comment https://forums.phpfreaks.com/topic/86487-solved-info-not-going-to-db-email-not-sending/#findComment-441976 Share on other sites More sharing options...
aebstract Posted January 17, 2008 Author Share Posted January 17, 2008 I didn't get connected to the same tech. but the guy I talked to had me go run a command line: "telnet berryequipment.net 25" which showed the result of: 220 hs25.order-vault.net ESMTP Sendmail 8.11.6/8.11.6; Thu, 17 Jan 2008 12:27:00 -0500 Quote Link to comment https://forums.phpfreaks.com/topic/86487-solved-info-not-going-to-db-email-not-sending/#findComment-441981 Share on other sites More sharing options...
revraz Posted January 17, 2008 Share Posted January 17, 2008 Ask him to do it using mail() for php. Quote Link to comment https://forums.phpfreaks.com/topic/86487-solved-info-not-going-to-db-email-not-sending/#findComment-441982 Share on other sites More sharing options...
aebstract Posted January 17, 2008 Author Share Posted January 17, 2008 I'm back on the phone right now, will ask and I found this in my php.ini: [mail function] ; For Win32 only. SMTP = localhost ; For Win32 only. sendmail_from = me@localhost.com ; For Unix only. You may supply arguments as well (default: "sendmail -t -i"). sendmail_path = /usr/sbin/sendmail -t -i I'm thinking it may be wrong "me@localhost.com" and I'm on a .net domain. So maybe it isn't sending out correctly? I'll come back with another update soon. Quote Link to comment https://forums.phpfreaks.com/topic/86487-solved-info-not-going-to-db-email-not-sending/#findComment-441983 Share on other sites More sharing options...
aebstract Posted January 17, 2008 Author Share Posted January 17, 2008 Got this problem solved. It turns out that the fact that we have our email server and web server set up on two different servers/accounts I had to get him to fix some settings on their end for it to actually send out. Thanks for the help and sorry for the bother! Quote Link to comment https://forums.phpfreaks.com/topic/86487-solved-info-not-going-to-db-email-not-sending/#findComment-442023 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.