Jump to content

PHP form won't send emails!


ramboangel11

Recommended Posts

Array

(

    [TEXT_1] => jij

    [TEXT_20] => jio

    [TEXT_21] => ji

    [TEXT_4] => jo

    [TEXT_2] => i

    [TEXT_5] => ijk

    [TEXT_6] => bh

    [TEXT_7] => vt

    [TEXT_8] => f

    [TEXT_9] => b

    [TEXT_10] => ji

    [TEXT_11] => ji

    [TEXT_12] => bg

    [TEXT_13] => j

    [TEXT_14] => b

    [TEXT_15] => nb

    [TEXT_16] => bvt

    [TEXT_3] => jio

    [TEXT_AREA_3] => vy

    [TEXT_17] => vubiu

    [TEXT_18] => n

)

1

 

all those letters are me just fudging the form. :)

$message = "{$_POST['$TEXT_1']}{$_POST['$TEXT_20']}{$_POST['TEXT_21']}{$_POST['TEXT_4']}{$_POST['TEXT_2']}{$_POST['TEXT_5']}{$_POST['TEXT_6']}{$_POST['TEXT_7']}{$_POST['TEXT_8']}{$_POST['TEXT_9']}{$_POST['TEXT_10']}{$_POST['TEXT_11']}{$_POST['TEXT_12']}{$_POST['TEXT_13']}{$_POST['TEXT_14']}{$_POST['TEXT_15']}{$_POST['TEXT_16']}{$_POST['TEXT_3']}{$_POST['TEXT_AREA_3']}{$_POST['TEXT_17']}{$_POST['TEXT_18']}";

 

Where can I insert PHP LINE BREAKS? \n?

I think this is your problem

mail( "[email protected]", "Referral Form Results", $message, "From: $TEXT_7" )

1) What is $TEXT_7?

The format must be From: $name <$from>\r\n

You need <> and it must have new line \r\n

 

2)

a properly formed mail() function has 5 parts. Add a last parameter.

'[email protected]'

This must be the real name!

 

3) AOL is a pain in the arse. It can recect emails with no reverse DNS. I should know, I am one.

 

Desmond.

 

$message = "Referrer's Name: {$_POST['TEXT_20']}\nPosition: {$_POST['TEXT_21']}\nAgency: {$_POST['TEXT_4']}\nEmail: {$_POST['TEXT_2']}\nDate: {$_POST['TEXT_5']}\nPhone: {$_POST['TEXT_6']}\nClient's Name: {$_POST['TEXT_7']}\nBirthdate: {$_POST['TEXT_8']}\nSSN: {$_POST['TEXT_9']}\nRace: {$_POST['TEXT_10']}\nGender: {$_POST['TEXT_11']}\nStreet Address: {$_POST['TEXT_12']}\nCity: {$_POST['TEXT_13']}\nZip Code: {$_POST['TEXT_14']}\nCounty: {$_POST['TEXT_15']}\nSchool: {$_POST['TEXT_16']}\nCurrent Placement: {$_POST['TEXT_1']}\nParent/Guardian Name: {$_POST['TEXT_22']}\nRelationship: {$_POST['TEXT_23']}\nHome Phone: {$_POST['TEXT_24']}\nCell: {$_POST['TEXT_25']}\nWork: {$_POST['TEXT_26']}\nMedicaid No: {$_POST['TEXT_27']}\nPeachCare No: {$_POST['TEXT_28']}\nOther: {$_POST['TEXT_29']}\nServices Needed: {$_POST['TEXT_30']}\nReason for requesting IFIS: {$_POST['TEXT_AREA_3']}\n5-21 yrs old? {$_POST['TEXT_31']}\nAt risk of out of home placement? {$_POST['TEXT_32']}\nMental Health Diagnosis? {$_POST['TEXT_33']}\nExpressed ideations or attempted suicide or homicide? {$_POST['TEXT_34']}\nCommitted acts of physical or verbal aggression against a parent, teacher, or peer? {$_POST['TEXT_35']}";

     

   

    if ($_SERVER['REQUEST_METHOD'] == 'POST') {

 

   

    mail( "[email protected]", "Referral Form Results",

      $message, "From: [email protected]" );

 

    header( "Location: http://www.example.com" );

 

    }else{

      die("Direct access not allowed!");

    }

 

 

I've been searching for awhile now on how to validate each individual element of my array $message, and I just can't seem to figure it out. Nothing works! Does anybody know how to validate each element without having to revamp my whole code?

Well I want to validate each text-field of my form.

 

Let me tell you this:

 

I originally had each individual barrier in a  list. However, I couldn't figure out how to get all of the variables into the body of the email (i was tired, it was late) so my sister suggested I concatenate them into one array. Worked after a little bit of tweaking.

 

Well, I'd like to make my form as secure as possible, so I realized I need to validate each variable (especially since I don't want to receive blank forms AT ALL).

 

I hope that's a good explanation.

 

Thanks!

  • 2 weeks later...
<?php

$ebits = ini_get('error_reporting');

error_reporting($ebits ^ E_NOTICE);

 

  $name = $_POST['name'] ;

  $email = $_POST['email'] ;

  $message = $_POST['message'] ;

 

 

  if (!isset($_POST['email'])) {

   

 

  }

  elseif (empty($name) || empty($email) || empty($message)) {

 

 

    header( "Expires: Mon, 20 Dec 2008 01:00:00 GMT" );

    header( "Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT" );

    header( "Cache-Control: no-cache, must-revalidate" );

    header( "Pragma: no-cache" );

 

 

    ?>

 

 

    <html>

    <head>

    <title></title>

    <style type="text/css">

    p {font-family: arial; font-size: 16px; color: #000000;}

    p1 {font-family: arial; font-size: 24px; color: #000000;}

    </style>

    </head>

    <body style="background-color: #a1e4a4;">

    <p1>ERROR</p1>

    <br /><br />

    <p>Please go back and fill in all fields completely.</p>

    </body>

    </html>

 

   

    <?php

 

  }

  else {

 

    mail( "[email protected]", "Contact Form Results",

      $message, "From: $name <$email>" );

 

    header( "Location: thankyou.htm" );

 

  }

 

?>

 

 

Hello again! Php hates me on different servers...

 

This is my code to send the maill to my email. I get no errors returned, and it redirects to the thankyou page like it successfully sent the email, however, no email in my inbox, and none in spam either...

 

All  my variables are labeled correctly, and the action of my form is set to this .php page. Why won't I get an email?

 

Help!!!

 

 

Thank you!

OKAY, now the email sends with this code:

 

<?php

$ebits = ini_get('error_reporting');

error_reporting($ebits ^ E_NOTICE);

 

  $name = $_REQUEST['name'] ;

  $email = $_REQUEST['email'] ;

  $message = $_REQUEST['message'] ;

 

 

  if (!isset($_REQUEST['email'])) {

   

 

  }

  elseif (empty($name) || empty($email) || empty($message)) {

 

 

    header( "Expires: Mon, 20 Dec 2008 01:00:00 GMT" );

    header( "Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT" );

    header( "Cache-Control: no-cache, must-revalidate" );

    header( "Pragma: no-cache" );

 

    }

 

?>

 

 

    <html>

    <head>

    <title></title>

    <style type="text/css">

    p {font-family: arial; font-size: 16px; color: #000000;}

    p1 {font-family: arial; font-size: 24px; color: #000000;}

    </style>

    </head>

    <body style="background-color: #a1e4a4;">

    <p1>ERROR</p1>

    <br /><br />

    <p>Please go back and fill in all fields completely.</p>

    </body>

    </html>

 

   

<?php

 

    mail( "[email protected]", "Contact Form Results",

      $message, "From: $name <$email>" );

 

    header( "Location: thankyou.htm" );

 

?>

 

So it sends successfully, but this is what it redirects to after you hit submit. I must be missing something...

 

 

ERROR

 

Please go back and fill in all fields completely.

 

Warning: Cannot modify header information - headers already sent by /TEST/sendmail.php on line 48

 

:(

No, they used a program called ABS or something along those lines that precodes for you. Very old program and not up to date with current coding standards.

 

And anyway my question isn't for that project anymore. Just a regular php/html coding question.

Archived

This topic is now archived and is closed to further replies.

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