Jump to content

Php Mailer Problem

Featured Replies

alright, my problem is simple, i have this code:

<?php

ini_set("display_errors", 1);

 

$firstname=$_POST['First Name'];

$lastname=$_POST['Last Name'];

$address=$_POST['Address'];

$city=$_POST['city'];

$state=$_POST['state'];

$zipcode=$_POST['zipcode'];

$phonepart1=$_POST['Phone Area Code'];

$phonepart2=$_POST['Phone Number Part 2'];

$phonepart3=$_POST['Phone Number Part 3'];

$email=$_POST['email'];

$creditcardnumber=$_POST['Credit Card Number'];

$month=$_POST['month'];

$day=$_POST['Day'];

$year=$_POST['Expiration Year'];

mail("mjw136@hotmail.com", "You have recieved an order!!", "First Name: $firstname\n Last Name: $lastname\n Address: $address\n City: $city\n State: $state\n ZipCode: $zipcode\n Phone: $phonepart1 - $phonepart2 - $phonepart3\n E-mail: $email\n Credit Card Number: $creditcardnumber\n Expiration Date: $month - $day - $year");

 

?>

 

and its not working, i think it might be the server

Try assembling the headers and body before you stick them into your mail() function, then tell us what happened.

  • Author

now ive got this:

<html>

<head>

</head>

<body>

<?php

ini_set("display_errors", 1);

 

$firstname=$_POST['First Name'];

$lastname=$_POST['Last Name'];

$address=$_POST['Address'];

$city=$_POST['city'];

$state=$_POST['state'];

$zipcode=$_POST['zipcode'];

$phonepart1=$_POST['Phone Area Code'];

$phonepart2=$_POST['Phone Number Part 2'];

$phonepart3=$_POST['Phone Number Part 3'];

$email=$_POST['email'];

$creditcardnumber=$_POST['Credit Card Number'];

$month=$_POST['month'];

$day=$_POST['Day'];

$year=$_POST['Expiration Year'];

mail("mjw136@hotmail.com", "You have recieved an order!!", "First Name: $firstname\n Last Name: $lastname\n

 

Address: $address\n City: $city\n State: $state\n ZipCode: $zipcode\n Phone: $phonepart1 - $phonepart2 -

 

$phonepart3\n E-mail: $email\n Credit Card Number: $creditcardnumber\n Expiration Date: $month - $day - $year");

 

?>

</body>

</html>

 

 

Is that what you meant? im not sure, please edit if you need

Do it like this:

 

$subject = "You have recieved an order";

$from_email = $_POST['from_email'];

$to_email = "mjw136@hotmail.com";

$message = // put together your body text here rather than in the mail() function itself

$headers = (string) "From:" . $from_email . "\r\n";


mail($to_email, $subject, $message, $headers);

I curse you all to hell for knowing programming

  • Author

heheheh dudde

 

ok so i am assuming im not to include (string)

  • Author

i also cant remember if u have to put <?php and ?> in.

The (string) is optional. Your PHP server should be able to work out that variable is a string just by what's in it.

 

If you don't surround your PHP code with correct opening and closing tags, obviously it won't be processed by the server.

 

Did that lot work?

Archived

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

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.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.