Page 1 of 1

Sending Form data error

Posted: Wed Dec 06, 2006 8:06 am
by iceDonkey
feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]


Hello all,

I'm using phpmailer to send form data via email

The following error occurs when the submit button is pressed:

Message could not be sent. Mailer Error: Language string failed to load: recipients_failedxxxxx@xxxxx.com

Here is the code:

Code: Select all

<?php
    $headers .= "Title: " . $_POST['requiredtitle'] . "\r\n";
  $headers .= "First Name: " . $_POST['requiredfirst_name'] . "\r\n";
  $headers .= "Last Name: " . $_POST['requiredlast_name'] . "\r\n";
  $headers .= "Birth Date Day: " . $_POST['requiredBirthDate_dd'] . "\r\n";
  $headers .= "Birth Date Month: " . $_POST['requiredBirthDate_mm'] . "\r\n";
  $headers .= "Birth Date Year: " . $_POST['requiredBirthDate_yyyy'] . "\r\n";
  $headers .= "Address: " . $_POST['requiredaddress'] . "\r\n";
  $headers .= "Town/Suburb: " . $_POST['requiredtown_suburb'] . "\r\n";
  $headers .= "State: " . $_POST['requiredCustState'] . "\r\n";
  $headers .= "PostCode: " . $_POST['requiredpostcode'] . "\r\n";
  $headers .= "How long at address: " . $_POST['How_Long_at_Address'] . "\r\n";
  $headers .= "Email: " . $_POST['requiredemail'] . "\r\n";
  $headers .= "Telephone: " . $_POST['requiredphone'] . "\r\n";
  $headers .= "Mobile: " . $_POST['mobile'] . "\r\n";
  $headers .= "Work Phone: " . $_POST['requiredwork_phone'] . "\r\n";
  $headers .= "Found Us: " . $_POST['find'] . "\r\n";
  $headers .= "Referred By: " . $_POST['referrer'] . "\r\n";
  $headers .= "Other: " . $_POST['explain'] . "\r\n";
  $headers .= "Outstanding Loan: " . $_POST['outstanding_loan'] . "\r\n";
  $headers .= "Next of Kin Title: " . $_POST['requirednktitle'] . "\r\n";
  $headers .= "Next of Kin First Name: " . $_POST['requirednk_firstname'] . "\r\n";
  $headers .= "Next of Kin Last Name: " . $_POST['requirednk_lastname'] . "\r\n";
  $headers .= "Next of Kin Relation: " . $_POST['requirednk_relation'] . "\r\n";
  $headers .= "Next of Kin Telephone: " . $_POST['requirednk_phone'] . "\r\n";
  $headers .= "Next of Kin Address: " . $_POST['requirednk_address'] . "\r\n";
  $headers .= "Next of Kin State: " . $_POST['requirednk_state'] . "\r\n";
  $headers .= "Next of Kin Postcode: " . $_POST['requirednk_postcode'] . "\r\n";
  $headers .= "Document 1: " . $_POST['doc1'] . "\r\n";
  $headers .= "Document 2: " . $_POST['doc2'] . "\r\n";
  $headers .= "Document 3: " . $_POST['doc3'] . "\r\n";
  $headers .= "Document 4: " . $_POST['doc4'] . "\r\n";
  $headers .= "Total Points: " . $_POST['totalpoints'] . "\r\n";
  $headers .= "Has License: " . $_POST['havelicense'] . "\r\n";
  $headers .= "Employer Name: " . $_POST['requiredempname'] . "\r\n";
  $headers .= "ABN: " . $_POST['requiredabn'] . "\r\n";
  $headers .= "Employer Address: " . $_POST['requiredempaddress'] . "\r\n";
  $headers .= "Employer Phone: " . $_POST['requiredempphone'] . "\r\n";
  $headers .= "Employer Title: " . $_POST['emptitle'] . "\r\n";
  $headers .= "Employer First Name: " . $_POST['empfirstname'] . "\r\n";
  $headers .= "Employer Last Name: " . $_POST['emplastname'] . "\r\n";
  $headers .= "Employment Length: " . $_POST['emplength'] . "\r\n";
  $headers .= "Employment Level: " . $_POST['emplevel'] . "\r\n";
  $headers .= "Net Income: " . $_POST['netincome'] . "\r\n";
  $headers .= "Pay Rate: " . $_POST['payrate'] . "\r\n";
  $headers .= "Pay Date Day: " . $_POST['PayDate_dd'] . "\r\n";
  $headers .= "Pay Date Month: " . $_POST['PayDate_mm'] . "\r\n";
  $headers .= "Pay Date Year: " . $_POST['PayDate_yyyy'] . "\r\n";
  $headers .= "Financial Institution Name: " . $_POST['finame'] . "\r\n";
  $headers .= "Financial Institution Branch: " . $_POST['fibranch'] . "\r\n";
  $headers .= "Account Name: " . $_POST['accname'] . "\r\n";
  $headers .= "BSB: " . $_POST['bsb'] . "\r\n";
  $headers .= "Account Number: " . $_POST['accnum'] . "\r\n";
  $headers .= "Credit Card Type: " . $_POST['cctype'] . "\r\n";
  $headers .= "Credit Card Number: " . $_POST['ccnum'] . "\r\n";
  $headers .= "Credit Card Batch: " . $_POST['ccbatch'] . "\r\n";
  $headers .= "Credit Card Name: " . $_POST['ccname'] . "\r\n";
  $headers .= "Credit Card Expiry Month: " . $_POST['CC_Expire_mm'] . "\r\n";
  $headers .= "Credit Card Expiry Year: " . $_POST['CC_Expire_yyyy'] . "\r\n";
  $headers .= "Bankrupt: " . $_POST['bankrupt'] . "\r\n";
  $headers .= "Requested Loan Amount: " . $_POST['AmntLoanRqsted'] . "\r\n";
  $headers .= "Loan Length: " . $_POST['loanlength'] . "\r\n";
  $headers .= "Other Info: " . $_POST['other_info'] . "\r\n";
  $headers .= "Terms: " . $_POST['requiredterms'] . "\r\n";
      require("phpmailer.php");
$mail = new PHPMailer();

$mail->IsSMTP();
$mail->Host = "MAIL.xxxxxx.COM";
$mail->SMTPAuth = true;
$mail->Username = "xxxxx@xxxxxx.com";
$mail->Password = "xxxxx";

$mail->From = "xxxx@xxxxx.com";
$mail->FromName = "xxxxxx.com";//optional from name
$mail->AddAddress("xxxxx@xxxxx.com", "xxxxxx");

$mail->WordWrap = 72;
//$mail->AddReplyTo("sender@example.com", "Information");
$mail->IsHTML(False); // set email format to HTML

$mail->Subject = "Application ";
$mail->Body = $headers;
if(!$mail->Send()) {
echo "Message could not be sent. <p>";
echo "Mailer Error: " . $mail->ErrorInfo;
}

?>
<!--<script type="text/javascript">

window.location = "http://www.xxxxxx.com.au/thankyouapply.html"

</script> -->
I have the javascript commented out as I wasn't receiving the emails and I wanted to see the error come up.

Can anyone identify the problem here?

Thanks,


feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]

Posted: Wed Dec 06, 2006 8:34 am
by kiajoe777
Well, I'm not even sure I'd want to help you with this as you are sending credit card and other personal information over email which is a HUGE no-no. It's very insecure and can easily be sniffed out by someone ...

Posted: Wed Dec 06, 2006 5:06 pm
by iceDonkey
Thanks for the reminder. I'll start from scratch and set up a database with an SSL connection.

Posted: Wed Dec 06, 2006 5:10 pm
by iceDonkey
Feyd, thanks for changing the code for me and pointing me in the right direction.

My client produced the form and sent it to me to tweak and upload. Instead of being slack, I should've advised them there is a secure way of doing things.

Ice ----> walk off with tail between legs

Posted: Wed Dec 06, 2006 6:53 pm
by RobertGonzalez
If you have to send it, truncate the data so complete information is not sent. Or mock it.

Posted: Wed Dec 06, 2006 9:08 pm
by iceDonkey
Thanks, I'll do that.

Will my original problem still be there tho?

Will i get the same error come up?

Posted: Thu Dec 07, 2006 10:36 am
by RobertGonzalez
Sorry about that, I got wrapped up in the sensitive information department.

I know crap about phpMailer, but I do know that Swiftmailer blows it out of the water. You should take a look at Swift.