Skip to main content
Known Participant
April 7, 2017
Answered

Form will not send to email.

  • April 7, 2017
  • 3 replies
  • 9709 views

I have two files on my server at GoDaddy, the first is my form:

<style type="text/css">

body {

    margin-left: 0px;

    margin-top: 0px;

    margin-right: 0px;

    margin-bottom: 0px;

   

}

#FormDiv {

    Width: 400px;

    height: auto;

    margin-left: auto;

    margin-right: auto;

    margin-top: 60px;

    background: #EAEAEA;

    padding-top: 2px;

    padding-right: 2px;

    padding-bottom: 2px;

    padding-left: 2px;

    border: medium groove #E01D20;

}

</style>

</head>

<body>

<div id="FormDiv" >

  <form action="mailscript.php" method="post" name="ContactForm" id="ContactForm">

 

  <table align="center">

    <tbody>

      <tr>

        <td><label for="Subject"></label>

       <input type="text" name="Subject" id="Subject" form="ContactForm" /></td>

      </tr>

      <tr>

        <td><label for="Message"></label>

        <textarea name="Message" cols="45" rows="5" id="Message" form="ContactForm"></textarea></td>

      </tr>

      <tr>

        <td></td>

      </tr>

      <tr>

        <td> </td>

      </tr>

      <tr>

        </td>

      </tr>

      <tr>

        <td><input name="SubmitButton" type="submit" id="Submit Button" form="ContactForm" value="Send Message" /></td>

      </tr>

    </tbody>

  </table>

  </form>

 

 

</div>

Second file is the script:

<?php

$from="noreply@gmail.com";

$email="xxxxxxxxxxxxx.gmail.com";

$subject=$_POST['Subject'];

$message=$_POST['Message'];

mail ( $email, $subject, $message, "From:".$from );

Print "your message has been sent";

?>

When I submit the form the browser responds with "your message has been sent" but I have no email in my box. I am wondering if I typed something wrong (built following a tutorial) or if I am missing some kind of setting or application on my webserver, or a call in one of my files, etc. I am a newbie, however I do pretty much understand most of what I am doing with simple html and most of the information above save a bit of confusion on "id" vs "name" etc.

Thanks for any input you may have.

This topic has been closed for replies.
Correct answer osgood_

Yes.


RacinghomeLLC  wrote

Yes.

If your host says they support the php mail function then the very first bit of php code you posted will work (see below). It's not the greatest of codes as it doesnt check anything sent from the form input fields, but you should get a response.

The other factor in this is it may be gmail stopping the information getting to you. Do you have another email address you could try?

<?php

$from="noreply@gmail.com";

$email="xxxxxxxxxxxxx.gmail.com";

$subject=$_POST['Subject'];

$message=$_POST['Message'];

mail ( $email, $subject, $message, "From:".$from );

Print "your message has been sent";

?>

3 replies

Nancy OShea
Community Expert
Community Expert
April 7, 2017

Depending on which hosting plan you have, GoDaddy has a few form processing scripts you can use.   See links below.

Using Our PHP Form Mailers on Web & Classic Hosting | Web & Classic Hosting - GoDaddy Help US

Using the CGI Form-Mailer | Web & Classic Hosting - GoDaddy Help US

Nancy O'Shea— Product User & Community Expert
Legend
April 7, 2017

How are you testing this form?

Have you uploaded it to your remote server and tested from that location:

Does your host (GoDaddy) support the php mail function?

The code you provided works.

Known Participant
April 7, 2017

Yes, I am testing it on my domain hosted at GoDaddy. Not sure if PHP is enabled on my package, I will call them and see. Thank you for your response. Scott

Community Expert
April 7, 2017

The code you have doesn't actually check anything.  It just prints the message "your message has been sent" no matter what happens.  If you want to test the function you need code like:

if(@mail($emailRecipient, $subject, $message, $headers))
{
  echo
"Mail Sent Successfully";
}else{
  echo
"Mail Not Sent";
}

I also saw this post in Godaddy's forums of other users who are having issues.  Some of them had to reach out to Godaddy support because it was a configuration issue.  Have you tried reaching out to them?

Solved: PHP mail() not sending - GoDaddy Community

Known Participant
April 7, 2017

[Ben]The code you have doesn't actually check anything.  It just prints the message "your message has been sent" no matter what happens.  If you want to test the function you need code like:

if(@mail($emailRecipient, $subject, $message, $headers))
{
  echo
"Mail Sent Successfully";
}else{
  echo
"Mail Not Sent";
}

[Scott]Thank you for your response. I will try to put that into my script and replace the submit and print lines I have already? Also, is that "if statement" PHP or am I adding something new to my tools?

[Ben]I also saw this post in Godaddy's forums of other users who are having issues.  Some of them had to reach out to Godaddy support because it was a configuration issue.  Have you tried reaching out to them?

[Scott]I called them last night as well as phone contact with Adobe and they made some changes to my MX which GoDaddy confirmed then they turned me to their webhosting help and they were not able to help.
Thanks, Scott