php mailing not working. any help me?

Reply

Join Date: Apr 2008
Posts: 10
Reputation: muthu raj is an unknown quantity at this point 
Solved Threads: 0
muthu raj muthu raj is offline Offline
Newbie Poster

php mailing not working. any help me?

 
0
  #1
May 28th, 2008
php mailing not working. any help me?


i used the code to send mail is as follows:
<?php
$to = "someone@example.com";
$subject = "Test mail";
$message = "Hello! This is a simple email message.";
$from = "someonelse@example.com";
$headers = "From: $from";
mail($to,$subject,$message,$headers);
echo "Mail Sent.";
?>


when i am executing i am getting following error:
Warning: mail() [function.mail]: Failed to connect to mailserver at "localhost" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in C:\Program Files\xampp\htdocs\samplemuthu\file.php on line 7
Reply With Quote Quick reply to this message  
Join Date: Dec 2007
Posts: 252
Reputation: ProfessorPC is an unknown quantity at this point 
Solved Threads: 27
ProfessorPC ProfessorPC is offline Offline
Posting Whiz in Training

Re: php mailing not working. any help me?

 
0
  #2
May 28th, 2008
it doesnt look like your mailserver settings are correct in your php.ini file. this article will help you with this setup.
http://www.sitepoint.com/article/advanced-email-php
Reply With Quote Quick reply to this message  
Join Date: Feb 2008
Posts: 478
Reputation: maydhyam is an unknown quantity at this point 
Solved Threads: 1
maydhyam's Avatar
maydhyam maydhyam is offline Offline
Posting Pro in Training

Re: php mailing not working. any help me?

 
0
  #3
May 28th, 2008
Hi,
  1. Search your computer for the 'php.ini' file....
  2. Once you have found it's location, open it using Notepad.exe
  3. Click Edit - Find and enter [mail function] now search for it within the document
  4. You should find this:

    [mail function]
    ; For Win32 only.
    SMTP = localhost
    smtp_port = 25

    ; For Win32 only.
    ;sendmail_from = me@example.com

    ; For Unix only. You may supply arguments as well (default: "sendmail -t -i").
    ;sendmail_path =sendmail -t -i
The man who in view of gain thinks of righteousness; who in the view of danger is prepared to give up his life; and who does not forget an old agreement however far back it extends - such a man may be reckoned a complete man.
~ Confucius, The Confucian Analects
Reply With Quote Quick reply to this message  
Join Date: May 2008
Posts: 19
Reputation: phpuser is an unknown quantity at this point 
Solved Threads: 1
phpuser phpuser is offline Offline
Newbie Poster

Re: php mailing not working. any help me?

 
0
  #4
May 28th, 2008
Hi,You can use sleep() function just after mail($to,$subject,$message,$headers);
like this

mail($to,$subject,$message,$headers);
sleep(5);

may be it will works.


Originally Posted by muthu raj View Post
php mailing not working. any help me?


i used the code to send mail is as follows:
<?php
$to = "someone@example.com";
$subject = "Test mail";
$message = "Hello! This is a simple email message.";
$from = "someonelse@example.com";
$headers = "From: $from";
mail($to,$subject,$message,$headers);
echo "Mail Sent.";
?>


when i am executing i am getting following error:
Warning: mail() [function.mail]: Failed to connect to mailserver at "localhost" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in C:\Program Files\xampp\htdocs\samplemuthu\file.php on line 7
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC