Wrox Programmer Forums
|
BOOK: Professional PHP 5 ISBN: 978-0-7645-7282-1
This is the forum to discuss the Wrox book Professional PHP5 by Ed Lecky-Thompson, Heow Eide-Goodman, Steven D. Nowicki, Alec Cove; ISBN: 9780764572821
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Professional PHP 5 ISBN: 978-0-7645-7282-1 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old May 10th, 2009, 03:22 AM
Authorized User
 
Join Date: Dec 2007
Posts: 65
Thanks: 9
Thanked 2 Times in 2 Posts
Send a message via AIM to sandeepgreaternoida Send a message via MSN to sandeepgreaternoida Send a message via Yahoo to sandeepgreaternoida
Default mail()

php script
Code:
<?php
$to = "sandeepgreaternoida@gmail.com";
$subject = "Your email has been sent!";
$body = "This is a test";
if(mail($to,$subject,$body)){
	echo "<b>PHP has sent your email<b>";
}
?>
change in php.ini
Code:
[mail function]
 ;For Win32 only.
SMTP = smtp.my.server.net
smtp_port = 25

;For Win32 only.
sendmail_from = sandeepgreaternoida@gmail.com
My prob:when i do execute the php script on the browser...just blank comes.(and mail does not send...no message displayed)
what would be the possible mistakes.
my apache server on window xp is running smoothly. and i have php 5 installed in my system.

Code:
thanx !
__________________
sandeep gupta
 
Old May 11th, 2009, 05:13 AM
Friend of Wrox
 
Join Date: Sep 2005
Posts: 166
Thanks: 2
Thanked 33 Times in 33 Posts
Default

Hi Sandeep,
The code looks fine - it looks like there is a problem with the email server settings. You need to at least try to get the error the mail function is calling.

In PHP5 the default is not to display errors on screen, for security reasons. You will probably find the message in the apache error log, which is where it is put by default. While you are developing the site, you can also set errors to be displayed on screen by opening php.ini and searching for display_errors - set this to On.

If you can get the error message being generated, we may be able to help with the mailing problem.

Phil
The Following User Says Thank You to philip_cole For This Useful Post:
sandeepgreaternoida (May 11th, 2009)
 
Old May 11th, 2009, 09:39 PM
Authorized User
 
Join Date: Dec 2007
Posts: 65
Thanks: 9
Thanked 2 Times in 2 Posts
Send a message via AIM to sandeepgreaternoida Send a message via MSN to sandeepgreaternoida Send a message via Yahoo to sandeepgreaternoida
Default php.ini and apache error log.

Dear Philip_cole
i made the following changes in php.ini..and after changing i again restart my system and chek the php mail script..but nothing came.
Code:
  display_errors = On
but when i went through my apache error log i found the following error
Code:
Foundation\\Apache2.2\\htdocs\\Beg\\15\\mail.php on line 5
[Tue May 12 07:00:26 2009] [error] [client 127.0.0.1] File does not exist: C:/Program Files/Apache Software Foundation/Apache2.2/htdocs/favicon.ico
---------------------------------------------------------
pls. help me out for the following php script
Code:
<?php
$to = "sandeepgreaternoida@gmail.com";
$subject = "Your email has been sent!";
$body = "This is a test";
if(mail($to,$subject,$body)){
	echo "<b>PHP has sent your email<b>";
}
?>
php.ini
Code:
[mail function]
 ;For Win32 only.
SMTP = smtp.my.server.net
smtp_port = 25

;For Win32 only.
sendmail_from = sandeepgreaternoida@gmail.com
Thanx a lot !
__________________
sandeep gupta





Similar Threads
Thread Thread Starter Forum Replies Last Post
Send mail and attachments with PHP mail function Lofa Beginning PHP 1 June 2nd, 2008 03:24 PM
problems sending mail with java mail gandacuboy J2EE 2 December 20th, 2006 03:05 PM
Sending e-mail to different mail box! Calibus Classic ASP Databases 4 September 3rd, 2004 05:48 PM
Sending both text mail and HTML mail - CDONTS madhukp Classic ASP Basics 1 October 8th, 2003 01:05 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.