Jump to content


PHP Mail Issue

  • Please log in to reply
4 replies to this topic

#1 7pm

  • Members
  • PipPip
  • Member
  • 17 posts

Posted 10 April 2006 - 05:54 PM

hi there...if someone can help out asap would be great!

i received help on this board [a href=\"http://www.phpfreaks.com/forums/index.php?showtopic=87985&st=\" target=\"_blank\"]HERE[/a] in order to get this code working and it tested out fine a few weeks back. i tried it now and can't get it to work. it's not sending me the email. i've checked with the main server and i was told it's running operating PHP fine. can someone look over the code and URL if need be to see if they notice any imperfections as to why it won't work now? the URL of the page it's used on is
[a href=\"http://www.cajjmere.com/online/order.html\" target=\"_blank\"]HERE[/a]. Many thanks in advance!

php code below: (minus first and last > symbols)

<body style="font-family: Arial">

$qtyrun = $_POST['qtyrun'];
$qtyex = $_POST['qtyex'];
$qtylate = $_POST['qtylate'];
$qtyturn = $_POST['qtyturn'];
$name = $_POST['yourname'];
$email = $_POST['email'];
$address = $_POST['address'];

if(!$name or !$email or !$address) {
if(!$name) die("You did not enter your name!");
if(!$email) die("You did not enter your email address!");
if(!$address) die("You did not enter your address!");


//make sure the email is a valid one using a simple regular exp. i found at regexlib.com
if(!preg_match("#^([a-zA-Z0-9_\-\.]+)@([a-zA-Z0-9_\-\.]+)\.([a-zA-Z]{2,5})$#", $email) ) {

die("This is not a valid email address!");

//use the simple function strip_tags() to clean out any html and JS from input
$name = strip_tags($name);
$address = strip_tags($address);

//do some small variable handling
$qtyrun = ($qtyrun == "") ? "0" : $qtyrun;
$qtyex = ($qtyex == "") ? "0" : $qtyex;
$qtylate = ($qtylate == "") ? "0" : $qtylate;
$qtyturn = ($qtyturn == "") ? "0" : $qtyturn;

//The above four lines will substitute the string "0" into the quantity variables if they are left empty.

//make the body text that will be emailed
$body = "An order has been submitted by: {$name}.

They have requested the following quantities:

DLI001 RUNWAY EP: {$qtyrun}
DLI002 EXSTACY QUEEN: {$qtyex}
DLI003 LATE NITE EP: {$qtylate}
DLICD0602 TURNING IT: {$qtyturn}

The address specified was:


$subject = "Order form from {$name}";

mail("orders@cajjmere.com", $subject, $body, "From: {$email}");

//Order form sent!

echo "Your order has been recieved and will be processed shortly!";

<p>Thank you for shopping at D'Lish-Us Music.
<p>You should receive an email with
full payment instructions within two hours.</p>

#2 7pm

  • Members
  • PipPip
  • Member
  • 17 posts

Posted 10 April 2006 - 07:12 PM

this is scarry....nobody can help? LOL

#3 7pm

  • Members
  • PipPip
  • Member
  • 17 posts

Posted 10 April 2006 - 07:38 PM

techy stuff kills me...it's working now...i don't get it. i'll have to see what's up with this.

#4 Desdinova

  • Members
  • PipPipPip
  • Advanced Member
  • 41 posts

Posted 10 April 2006 - 08:00 PM

you should check what the log generated.

#5 Flinch

  • Members
  • PipPip
  • Member
  • 13 posts
  • Locationcomputer, house, USA

Posted 11 April 2006 - 02:10 PM

It maybe possible that your websever doesn't have a mail server configured to it. Seems unlikely, but that could be the cause. Check with your sever and see what they use as their mail protocol. A lot of online webservers use POP* (* = version number) as their defualt mail server. It may also be SMTP. Not sure what else it might be because I've forgotten most of that script by now. If your webserver does have a mail server, post back and we'll go from there.

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users