I have index.php and process.php, both in my main host directory. My host, AwardSpace, supports php.

index.php:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Form</title>
</head>

<body>
<form method="post" action="http://***don't check it***.awardspace.com/process.php">
  Email: <input name="email" type="text" /><br />
  Message:<br />
  <textarea name="message" rows="15" cols="40">
  </textarea><br />
  <input type="submit" />
</form>
</body>
</html>

process.php:

<?php
  $email = $_REQUEST['email'] ;
  $message = $_REQUEST['message'] ;

  mail( "fatherchaos.wc3@gmail.com", "Feedback Form Results", $message, "From: $email" );
  header( "Location: index.php" );
?>

Everything seems to work fine, the header redirects the user back to the form after processing process.php, but no mail is sent.

Can anyone help?
Thanks!

    code looks ok, could be problem with mail in general on your server or gmail might filter it out.

    try sending it other to account like yahoo may be, to check if you can send email at all.

    if not then check your server mail records at http://www.dnsreport.com/

    Also I would not rule out a simple spelling mistake, make sure you spelled your email correctly

      The mail function will return true if it was sent. So you can put it into an if statement to check if it worked. I'd take out the header part for the purposes of testing by echoing a message telling you if the mail was sent or not.

      if( mail( "fatherchaos.wc3@gmail.com", "Feedback Form Results", $message, "From: $email" ) ) {
          echo 'The e-mail was sent';
      }else {
          echo 'The e-mail failed to send';
      }

      At least you will find out if gmail has blocked it or if it didn't even get sent in the first place.

        abc123 wrote:

        The mail function will return true if it was sent. So you can put it into an if statement to check if it worked. I'd take out the header part for the purposes of testing by echoing a message telling you if the mail was sent or not.

        if( mail( "fatherchaos.wc3@gmail.com", "Feedback Form Results", $message, "From: $email" ) ) {
            echo 'The e-mail was sent';
        }else {
            echo 'The e-mail failed to send';
        }

        At least you will find out if gmail has blocked it or if it didn't even get sent in the first place.

        I did it, it said the email was sent, but even with different accounts like hotmail it didn't work.

        What's going on :bemused:...

          Your code works fine I just sent myself an email with your script (of course I changed the email stuff) but except for that, it worked just fine. It might take a while for g-mail to work and possibly hotmail also since they are quite large, and you might want to check you junk folder on hotmail because all my mail goes there unless it is actually from Microsoft.

            A few hours, still no email. Could it be possible that the host is the problem? It however supports PHP... You may want to check it at www.awardspace.com...

            I highly doubt it's the problem though.

              why don't you use your own ISP's email as the sendmail_from in a php.ini like ini_set(sendmail_from=mail.yourisp.com) or ini_set(sendmail_from=smtp.yourisp.com)

                Houdini wrote:

                why don't you use your own ISP's email as the sendmail_from in a php.ini like ini_set(sendmail_from=mail.yourisp.com) or ini_set(sendmail_from=smtp.yourisp.com)

                Uh... Sorry, but what is a php.ini file? Do I need to install PHP to get it? Or do I just have to download it somewhere and put it in my main directory?

                  Well you are running it on your server if it is a remote host with php there has to be a php.ini, but you can't change that so you do it with script, the PHP will take the value of what you place in that script but only for the duration of that script, that way if you are having a problem with the host you make your own php.ini that will work instead of the servers.

                    It might be that the domain you are hosting on will not e-mail to external domains. Can you try sending an e-mail to an address on the domain you are hosting on?

                      Oh, in their website FAQ they say:

                      I can't send e-mail. All outgoing e-mails are being rejected. Why?
                      SMTP is disabled for the free accounts.

                      So I guess this is the problem.

                        I think they might have this in place as it would be easy for malicious people to get a free anonymous account and then create a script to spam people.

                        At least you know what the problem is now though.

                          Write a Reply...