Jump to content

mail() not working anymore despite it working perfectly at one point


Luker

Recommended Posts

Hello.  I've got a problem with sending values from a pretty straightforward form, to a pretty straightforward php script.  I have no idea how it broke, but I have not for the life of me been able to fix it since.  here is my form:

 

<form action="form-to-email.php" method="POST">


Hey Luke! <br><br>My name is <input type="text" name="name" placeholder="your name">. I like your work.  I'm looking for someone to to fill a position with skills in the following areas:  
<br><br>


<div class="checkboxes">
  <div class="leftcheckboxes">
 <input  type="checkbox" name="skillneeded" value="uxdesign">UX Design<br>
 <input type="checkbox" name="skillneeded" value="uidesign">UI Design<br>
 <input type="checkbox" name="skillneeded" value="interactiondesign">IxD<br>
  </div>
  <div class="rightcheckboxes">
 <input  type="checkbox" name="skillneeded" value="graphicdesign">Graphics<br>
 <input type="checkbox" name="skillneeded" value="webanimation">Web Animation<br>
 <input type="checkbox" name="skillneeded" value="frontend">Front End<br><br>
  </div>
</div>


Let me know if you'd like to come in to talk shop and discuss your eligibility for the position further in person. <br><br>


<textarea name="furtherdetails" placeholder=" further information" cols="40" rows="7"></textarea><br><br>
You can reach me at <input type="text" name="email" placeholder="your email">
<br><br><br>
<div class="submitbuttwrapper">
<input type="submit" value="Submit">
</div>
</form>

and here is the script:
 

<?php


error_reporting(-1);
ini_set('display_errors', 'On');
set_error_handler("var_dump");


//grab the values posted to the header and put them in vars
$name = $_POST['name'];
$furtherdetails = $_POST['furtherdetails'];
$email = $_POST['email'];
$skills = nl2br(implode(',', $_POST['skillneeded']));




$email_from = "$email";


$email_subject = "new form submission";


$email_body = "You received a new message from $name.\n\n".
              "$furtherdetails.\n\n".
              "$email.\n\n"
              "$skills";


$to = "luke.ryckman@gmail.com";


$headers = "From: $email \r\n";


mail($to, $email_subject, $email_body, $headers);
header('Location: http://www.lukeryckman.ca/thank-you.html');
?>

Currently it just goes to a 404 page.  Previously (today, whilst trying to fix), it has:
-sent me the form, with empty values
-sent me the form, with values in tact, but not proceeded onto thank-you.thml
-just not sent the form at all
-told me its the implode function messing things up (btw is there a more readable form of error reporting other then a blob of text?
-told me i had undefined vars(which was true at one point

 

So now, i am truely confused as to what is going on.  Im not a php guy, i just really want this functionality, that once worked.  Any help towards pointing me in the right direction would be greatly appreciated.  thank you

 

 

 

Link to comment
Share on other sites

Yeah, im sure I do, I just wanted it to work.  I did have some an attribute in the each field that checked if a certain number of chars had been entered before proceeding, but even that was only working 'sometimes', so i ditched it.  

Is there any pressing basic security stuff i could add to the php script?

Also, I have finally zoned in that its the implode() thats breaking it.  If i comment out the 'skills needed' checkboxes in the html, and remove references to $skillneeded in the php script, it works, and actually proceeds to the thank-you page

Link to comment
Share on other sites

Are we saying that maybe my server doesn't like mail() at all, or atleast the shoddy way ive implemented it, my issues are rooted in that (whether or not it once worked) and i should just ditch it all and invest the time in PHPmailer?

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.