Jump to content


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


PHP Mail Issue

Recommended Posts

hi there...if someone can help out [b]asap[/b] 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>

Share this post

Link to post
Share on other sites
techy stuff kills me...it's working now...i don't get it. i'll have to see what's up with this.

Share this post

Link to post
Share on other sites
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.

Share this post

Link to post
Share on other sites


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.