SkyRanger Posted April 16, 2007 Share Posted April 16, 2007 Not sure why this is not send out the email. Anybody have any ideas, or is there a way to test the problem? if ($submit) { $email = $semail; // Recive this by your email adress $subject = "Support - Ticket Number: $ticketno"; // Replace this by a subject $message = " ====================================================== Ticket Number: $ticketno Date of request: $sdate Subject: $ssubject Description: $formmessage To reply to this message, or send another ticket click below: http://$dbdomain Please do not reply to this message. ====================================================== From: $dbemail "; $header = "From: $dbemail\r\n"; if (mail($email, $subject, $message, $headers)) { $report = "Response sent"; } else { $report = "Your response could not be sent"; } echo "<b>$report</b>"; echo "<br><br>"; $connectionu=mysql_connect ("$dblocation", "$dbusername", "$dbpassword") or die ('I cannot connect to the database because: ' . mysql_error()); mysql_select_db ("$dbname"); mysql_db_query("$dbname", "UPDATE support SET status = 'completed', admin = '$adminname' WHERE ticketno = '$ticketno'") or die('I cannot update the database because: ' . mysql_error()); $sql = "INSERT INTO support_replies (ticketno,description,date,user) VALUES ('$ticketno','$formmessage','time()','$adminname')"; $result = mysql_query($sql) or die ('I could not add information to the database because ' . mysql_error()); mysql_close($connectionu); echo "Please click here to return to the:<br><a href=index2.php>$dbcompany Manager Index</a>"; I echoed all of the $ to make sure it displays and it does, it just won't send out the email. Quote Link to comment Share on other sites More sharing options...
Anzeo Posted April 16, 2007 Share Posted April 16, 2007 Are you sure your host supports SMTP email? If not, you cannot use the php mail function. I'm not sure on how to check wether your host supports it, try their site. Quote Link to comment Share on other sites More sharing options...
SkyRanger Posted April 16, 2007 Author Share Posted April 16, 2007 Yeah my host allows it. I have a client that has a php mail form that works no problem. I am not sure what the problem is with my code. Quote Link to comment Share on other sites More sharing options...
Anzeo Posted April 16, 2007 Share Posted April 16, 2007 Try to use it outside of the if clause. I assume you make a cpoy of it in your db? Does your db updates? Quote Link to comment Share on other sites More sharing options...
SkyRanger Posted April 16, 2007 Author Share Posted April 16, 2007 Yeah, this is annoying the heck out of me so I am going to try to email a different way. Quote Link to comment Share on other sites More sharing options...
per1os Posted April 16, 2007 Share Posted April 16, 2007 Just an FYI, the mail function does not always return what is expected. I have had it return false multiple times when the email was sent. Relying on the if statement to tell you if it was sent or not is not a very reliable method. Just an FYI. Quote Link to comment Share on other sites More sharing options...
SkyRanger Posted April 16, 2007 Author Share Posted April 16, 2007 Yeah, I have noticed that. I just check to see if sendmail is installed on my server and it is so I am back to square 1 trying to figure out why the thing isn't sending. Quote Link to comment Share on other sites More sharing options...
per1os Posted April 16, 2007 Share Posted April 16, 2007 Are you trying to send it to an email on your server or off? IE you@yourdomain.com or you@gmail.com I would try to send one to an off site email account and see what happens. Sometimes mail function does funky things when you are sending it to the domain you are currently on. If that does not work I would suggest going to www.php.net/mail and looking at the mail function particulary the "-f" portion. Quote Link to comment Share on other sites More sharing options...
SkyRanger Posted April 17, 2007 Author Share Posted April 17, 2007 Tried both, local works external doesn't. not sure about the -f still pretty new at the whole php mail function. Usually works for me but this time it is beating me down. Quote Link to comment Share on other sites More sharing options...
SkyRanger Posted April 17, 2007 Author Share Posted April 17, 2007 bump Quote Link to comment Share on other sites More sharing options...
SkyRanger Posted April 17, 2007 Author Share Posted April 17, 2007 Would anybody have an idea why my script will only deliver to email accounts on my server but not to email accounts outside of my server. ie: isp email,yahoo,google, etc. If they do is there a fix for this so I can get this stupid thing to work...lol Quote Link to comment Share on other sites More sharing options...
Anzeo Posted April 17, 2007 Share Posted April 17, 2007 Don't have a clue, try using your domain name to send a mail to your hotmail or gmail adress, using outlook or a similar program. Have you tried using the mail() outside of the if clause? As I can't seem to find where you've put your mail() function otherwise. Quote Link to comment Share on other sites More sharing options...
SkyRanger Posted April 17, 2007 Author Share Posted April 17, 2007 woohoo got it working, it was a server problem due to a rebuild of exim and the default settings 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.