Jump to content
The mkiv Supra Owners Club

PHP help


GeordieSteve

Recommended Posts

Noon chaps,

 

Having a bit of trouble with a PHP site I've been asked to modify for a number plate company. Basically it all looks like it's working fine but it should send the plate details to an email address I've specified but no mail arrives. Can I send the site over to anyone to have a once over? Never used PHP before

 

Cheers :)

Link to comment
Share on other sites

Check the php config settings for the mail server settings etc, normally in PHP it requires just a few lines to send an email as there are specific functions for it. Its most likely the POP / SMTP server addresses are wrong in the config file.

 

If not they might be doing it a different way, i.e connecting directly to the mail server in question , via sockets etc, but i seriously doubt that.

 

You can print out the config file settings by creating a PHP file on the server which just contains this " phpinfo(); ?>." without quotes.

 

Also this is a very useful site, http://www.php.net/

 

I would not advise sending any source to anyone, as the company in question may not be exactly chuffed about it.....

 

Si

Link to comment
Share on other sites

Configure.php doesn't enclude any pop3 or SMTP server addresses. It's as follows:

 

<?php

// Basics

$img_path = "images/";

$title = "ebay show Plate maker";

$payment_email = "[email protected]";

 

// Plate Information

$front_standard = "20.50 x 4.50"; // Standard front size

$rear_standard = "20.50 x 4.50"; // Standard rear size

 

$front_sizes = array(

"11.00 x 8.00",

"9.00 x 7.00",

"9.00 x 3.00");

 

$rear_sizes = array(

"11.00 x 8.00",

"9.00 x 7.00",

"9.00 x 3.00");

 

 

$cost = 16;

$reg_price = 0.0;

$tag_price = 0.0;

$font_price = 0.0;

$border_price = 0.0;

$badge_price = 0.0;

$background_price = 0.0;

$supply_front_price = 0;

$supply_rear_price = 0;

$front_size_price = 0;

$rear_size_price = 0;

 

?>

Link to comment
Share on other sites

If your on windows it will be PHP.ini...........and i think the directive your after are

 

SMTP "localhost" PHP_INI_ALL

smtp_port "25" PHP_INI_ALL Available since PHP 4.3.0.

 

http://uk.php.net/manual/en/ini.php#ini.list

 

 

Bare in mind if your on UNIX / Linux platform it might be using sendmail so check the path to send mail in the config. Im a bit rusty at this stuff, its been a while since i did some! lol.

Link to comment
Share on other sites

I would test using a piece of code like this:

 

<?php

 

$to = '[email protected]';

$subject = 'test';

$message = 'test email';

 

if (mail($to, $subject, $message, $headers)) {

echo 'email sent';

} else {

echo 'email failed';

}

 

?>

 

This will at least tell you whether the server is accepting the email. You may not receive the message from the server, but that's a different problem.

Link to comment
Share on other sites

I went to a PHP thing in London the other week. There advice on mail was not to use it, and use something such as Zend_Mail from the Zend framework- which seems a bit long winded. Although saying that ive never found 'mail' to be that bad.

 

Also make sure you have a 'from' address otherwise this will break it.

 

mail($to, $subject, $comments, $from)or die('mail not sent');

 

Where $comments == to your email content

 

Shaun

Link to comment
Share on other sites

Basically the mail function has got a response back from the mail server to acknowledge that the email was received. From here the mail server will send to the recipient. However the email could be blocked due to security, or it could be being caught by a SPAM filter, or the recipients email address is wrong.

Link to comment
Share on other sites

RIGHT! I've got it sending me email using:

 

<?php

$to = '[email protected]';

$subject = 'the subject';

$from = '[email protected]';

$message = 'hello';

 

if(mail($to, $subject, $message, "From: $from"))

echo "Mail sent";

else

echo "Mail send failure - message not sent"; ?>

 

 

However I can't get it sending mail using my site (more than likely due to me being hopeless)...

 

 

 

 

<?php

// designer

$reg = $_POST['reg'];

$fonts = $_POST['font'];

$tag_text = $_POST['tag'];

$borders = $_POST['border'];

$side_badges = $_POST['badge'];

$backgrounds = $_POST['background'];

$supply_front = $_POST['supply_front'];

$front_size = $_POST['front_size'];

$supply_rear = $_POST['supply_rear'];

$rear_size = $_POST['rear_size'];

$mail = $_POST['mail'];

 

$action = $_GET['action'];

 

$plate = "

[EBAY] Normal Plate design information \n".

"Registration number: ".$reg ."\n".

"Font number: ".$fonts ."\n".

"Tag text: ".$tag_text ."\n".

"Border number: ".$borders ."\n".

"Side badge: ".$side_badges ."\n".

"Background: ".$backgrounds ."\n".

"Front: Yes"."\n".

"Rear: Yes"."\n".

"E-mail of customer: ". $mail . ""

;

 

if ($reg == ""):

die ("You havent entered Your registration number!");

elseif (is_null ($mail) || $mail == "[email protected]"):

die ("You havent entered Your E-mail!");

elseif ($action == "checkout"):

 

$final = $plate;

//>>> DEBUG TURNED OFF >>> mail("[email protected]", "[EBAY] Plate Order - ".$reg, $final);

mail("[email protected]", "[EBAYshow] Plate Order - ".$reg, $final);

 

endif;

?>

http://www.customisedplates.com/ebayshowplates/Ebay-PlateMaker/order.gif

or Close Window
Link to comment
Share on other sites

Any advances on:

 

 

<?php

// designer

$reg = $_POST['reg'];

$fonts = $_POST['fonts'];

$tag_text = $_POST['tag_text'];

$borders = $_POST['borders'];

$l_side = $_POST['l_side'];

$side_badges = $_POST['side_badges'];

$backgrounds = $_POST['backgrounds'];

$supply_front = $_POST['supply_front'];

$front_size = $_POST['front_size'];

$supply_rear = $_POST['supply_rear'];

$rear_size = $_POST['rear_size'];

$honey = $_POST['honey'];

$chrome = $_POST['chrome'];

$fix = $_POST['fix'];

$mail = $_POST['mail'];

$from = '[email protected]';

 

 

$cost = $_POST['cost'];

 

$action = $_GET['action'];

 

if ($supply_front == "checkbox"):

$supply_front = "Yes";

endif;

if ($supply_rear == "checkbox"):

$supply_rear = "Yes";

endif;

if ($honey == "checkbox"):

$honey = "Yes";

endif;

if ($chrome == "checkbox"):

$chrome = "Yes";

endif;

if ($fix == "checkbox"):

$fix = "Yes";

endif;

 

 

$plate = "

[EBAY] Normal Plate design information \n".

"Registration number: ".$reg ."\n".

"Font number: ".$fonts ."\n".

"Tag text: ".$tag_text ."\n".

"Border number: ".$borders ."\n".

"Legal side badge: ".$l_side ."\n".

"Side badge: ".$side_badges ."\n".

"Background: ".$backgrounds ."\n".

"Front: Yes"."\n".

"Rear: Yes"."\n".

"Honey: ".$honey ."\n".

"\n\n Total Cost: " . $cost . "\n -------------------\n\n".

"E-mail of customer: ". $mail . ""

;

 

if ($reg == ""):

die ("You havent entered Your registration number!");

elseif (is_null ($mail) || $mail == "[email protected]"):

die ("You havent entered Your E-mail!");

elseif ($action == "checkout"):

 

$final = $plate;

//>>> DEBUG TURNED OFF >>> mail("[email protected]", "[EBAY] Plate Order - ".$reg, $final, $from = '[email protected]');

 

endif;

?>

http://www.customisedplates.com/ebayshowplates/Ebay-PlateMaker/order.gif

or Close Window
Link to comment
Share on other sites

Still no worky?

 

 

<?php

// designer

$reg = $_POST['reg'];

$fonts = $_POST['fonts'];

$tag_text = $_POST['tag_text'];

$borders = $_POST['borders'];

$l_side = $_POST['l_side'];

$side_badges = $_POST['side_badges'];

$backgrounds = $_POST['backgrounds'];

$supply_front = $_POST['supply_front'];

$front_size = $_POST['front_size'];

$supply_rear = $_POST['supply_rear'];

$rear_size = $_POST['rear_size'];

$honey = $_POST['honey'];

$chrome = $_POST['chrome'];

$fix = $_POST['fix'];

$mail = $_POST['mail'];

$from = '[email protected]';

 

 

$cost = $_POST['cost'];

 

$action = $_GET['action'];

 

if ($supply_front == "checkbox"):

$supply_front = "Yes";

endif;

if ($supply_rear == "checkbox"):

$supply_rear = "Yes";

endif;

if ($honey == "checkbox"):

$honey = "Yes";

endif;

if ($chrome == "checkbox"):

$chrome = "Yes";

endif;

if ($fix == "checkbox"):

$fix = "Yes";

endif;

 

 

$plate = "

[EBAY] Normal Plate design information \n".

"Registration number: ".$reg ."\n".

"Font number: ".$fonts ."\n".

"Tag text: ".$tag_text ."\n".

"Border number: ".$borders ."\n".

"Legal side badge: ".$l_side ."\n".

"Side badge: ".$side_badges ."\n".

"Background: ".$backgrounds ."\n".

"Front: Yes"."\n".

"Rear: Yes"."\n".

"Honey: ".$honey ."\n".

"\n\n Total Cost: " . $cost . "\n -------------------\n\n".

"E-mail of customer: ". $mail . ""

;

 

if ($reg == ""):

die ("You havent entered Your registration number!");

elseif (is_null ($mail) || $mail == "[email protected]"):

die ("You havent entered Your E-mail!");

elseif ($action == "checkout"):

 

$final = $plate;

$from = '[email protected]';

mail("[email protected]", "[EBAY] Plate Order - " . $reg, $final, $from);

 

endif;

?>

http://www.customisedplates.com/ebayshowplates/Ebay-PlateMaker/order.gif

or Close Window

 

 

Cheers for your help bud it's very very much appreciated

Link to comment
Share on other sites

... will you hate me if I say it's still not working?

 

 

<?php

// designer

$reg = $_POST['reg'];

$fonts = $_POST['fonts'];

$tag_text = $_POST['tag_text'];

$borders = $_POST['borders'];

$l_side = $_POST['l_side'];

$side_badges = $_POST['side_badges'];

$backgrounds = $_POST['backgrounds'];

$supply_front = $_POST['supply_front'];

$front_size = $_POST['front_size'];

$supply_rear = $_POST['supply_rear'];

$rear_size = $_POST['rear_size'];

$honey = $_POST['honey'];

$chrome = $_POST['chrome'];

$fix = $_POST['fix'];

$mail = $_POST['mail'];

$fromEmail= '[email protected]';

$from = "From: "[.$fromEmail]."\r\n";

$from .= "MIME-Version:1.0\r\n";

$from .= "Content-Type: text/plain; charset=\"us-ascii\"\r\n";

$from .= "Content-Transfer-Encoding: 7bit\r\n";

 

 

$cost = $_POST['cost'];

 

$action = $_GET['action'];

 

if ($supply_front == "checkbox"):

$supply_front = "Yes";

endif;

if ($supply_rear == "checkbox"):

$supply_rear = "Yes";

endif;

if ($honey == "checkbox"):

$honey = "Yes";

endif;

if ($chrome == "checkbox"):

$chrome = "Yes";

endif;

if ($fix == "checkbox"):

$fix = "Yes";

endif;

 

 

$plate = "

[EBAY] Normal Plate design information \n".

"Registration number: ".$reg ."\n".

"Font number: ".$fonts ."\n".

"Tag text: ".$tag_text ."\n".

"Border number: ".$borders ."\n".

"Legal side badge: ".$l_side ."\n".

"Side badge: ".$side_badges ."\n".

"Background: ".$backgrounds ."\n".

"Front: Yes"."\n".

"Rear: Yes"."\n".

"Honey: ".$honey ."\n".

"\n\n Total Cost: " . $cost . "\n -------------------\n\n".

"E-mail of customer: ". $mail . ""

;

 

if ($reg == ""):

die ("You havent entered Your registration number!");

elseif (is_null ($mail) || $mail == "[email protected]"):

die ("You havent entered Your E-mail!");

elseif ($action == "checkout"):

 

$final = $plate;

$from = '[email protected]';

mail("[email protected]", "[EBAY] Plate Order - " . $reg, $final);

 

endif;

?>

http://www.customisedplates.com/ebayshowplates/Ebay-PlateMaker/order.gif

or Close Window
Link to comment
Share on other sites

Lol you still dont have your from when your calling mail!

 

 

$fromEmail= '[email protected]';

$from = "From: ".$fromEmail."\r\n";

$from .= "MIME-Version:1.0\r\n";

$from .= "Content-Type: text/plain; charset=\"us-ascii\"\r\n";

$from .= "Content-Transfer-Encoding: 7bit\r\n";

 

mail("[email protected]", "[EBAY] Plate Order - " . $reg, $final, $from);

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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. You might also be interested in our Guidelines, Privacy Policy and Terms of Use.