Jump to content

[SOLVED] Sending Email Problem


SkyRanger

Recommended Posts

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.