GeordieSteve Posted March 12, 2008 Share Posted March 12, 2008 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 Quote Link to comment Share on other sites More sharing options...
ShamelessTT Posted March 12, 2008 Share Posted March 12, 2008 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 Quote Link to comment Share on other sites More sharing options...
GeordieSteve Posted March 12, 2008 Author Share Posted March 12, 2008 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; ?> Quote Link to comment Share on other sites More sharing options...
ShamelessTT Posted March 12, 2008 Share Posted March 12, 2008 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. Quote Link to comment Share on other sites More sharing options...
fri3ndly Posted March 12, 2008 Share Posted March 12, 2008 Something like this should be at the end of the script somewhere: mail($toaddress, $subject, $content, 'From: [email="[email protected]'"][email protected]'[/email]); ?> EDIT: Im guessing you know that already. If its all ok in the config, is it being blocked as spam? Quote Link to comment Share on other sites More sharing options...
GeordieSteve Posted March 12, 2008 Author Share Posted March 12, 2008 Am I right in thinking php.ini sits in the system32 folder or some such? I'm only going through a web host so have no access to the OS Quote Link to comment Share on other sites More sharing options...
GeordieSteve Posted March 12, 2008 Author Share Posted March 12, 2008 I'm wondering if the PHP mail function is disabled on the host Quote Link to comment Share on other sites More sharing options...
Shovels Posted March 12, 2008 Share Posted March 12, 2008 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. Quote Link to comment Share on other sites More sharing options...
GeordieSteve Posted March 12, 2008 Author Share Posted March 12, 2008 hmmm tried that and it doesn't even want to browse to the page... maybe PHP is down at the mo on my host Quote Link to comment Share on other sites More sharing options...
SupraShaun Posted March 12, 2008 Share Posted March 12, 2008 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 Quote Link to comment Share on other sites More sharing options...
GeordieSteve Posted March 12, 2008 Author Share Posted March 12, 2008 <?php $to = '[email protected]'; $subject = 'test'; $message = 'test email'; if (mail($to, $subject, $message, $headers)) { echo 'email sent'; } else { echo 'email failed'; } ?> QUOTE] hmmm done this and got the "email sent" message but no mail Quote Link to comment Share on other sites More sharing options...
ShamelessTT Posted March 12, 2008 Share Posted March 12, 2008 php.ini windows folder buddy....... use phpinfo(); ?>. To view it atleast..... Quote Link to comment Share on other sites More sharing options...
GeordieSteve Posted March 12, 2008 Author Share Posted March 12, 2008 Seems fine to me http://stepar76.freehostia.com/test.php Quote Link to comment Share on other sites More sharing options...
SupraShaun Posted March 12, 2008 Share Posted March 12, 2008 Have you set a from address? (In the code when you call the mail function) Shaun Quote Link to comment Share on other sites More sharing options...
Shovels Posted March 12, 2008 Share Posted March 12, 2008 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. Quote Link to comment Share on other sites More sharing options...
GeordieSteve Posted March 12, 2008 Author Share Posted March 12, 2008 Having a problem with the host now, can't get to any of the files on here... not my day to be fair! lol Quote Link to comment Share on other sites More sharing options...
GeordieSteve Posted March 13, 2008 Author Share Posted March 13, 2008 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 Quote Link to comment Share on other sites More sharing options...
SupraShaun Posted March 13, 2008 Share Posted March 13, 2008 You dont have a from address set mate Quote Link to comment Share on other sites More sharing options...
GeordieSteve Posted March 13, 2008 Author Share Posted March 13, 2008 ahhh some DID mention that a dozen times lol Off to try that Cheers bro Quote Link to comment Share on other sites More sharing options...
GeordieSteve Posted March 13, 2008 Author Share Posted March 13, 2008 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 Quote Link to comment Share on other sites More sharing options...
SupraShaun Posted March 13, 2008 Share Posted March 13, 2008 $from = '[email protected]'; mail("[email protected]", "[EBAY] Plate Order - " . $reg, $final, $from); Quote Link to comment Share on other sites More sharing options...
GeordieSteve Posted March 13, 2008 Author Share Posted March 13, 2008 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 Quote Link to comment Share on other sites More sharing options...
SupraShaun Posted March 13, 2008 Share Posted March 13, 2008 $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"; Quote Link to comment Share on other sites More sharing options...
GeordieSteve Posted March 13, 2008 Author Share Posted March 13, 2008 ... 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 Quote Link to comment Share on other sites More sharing options...
SupraShaun Posted March 13, 2008 Share Posted March 13, 2008 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); Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.
× 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.