test PHP mail() in localhost

Thread Solved

Join Date: Jan 2009
Posts: 37
Reputation: zeeyon is an unknown quantity at this point 
Solved Threads: 0
zeeyon's Avatar
zeeyon zeeyon is offline Offline
Light Poster

test PHP mail() in localhost

 
0
  #1
Apr 30th, 2009
hi, i have a hard time testing my PHP mail() function in the localhost.
can you teach me? it's my first time to use this mail() function.

this is my PHP code in the file: contact.php
  1. <?php
  2. $email_to = $_REQUEST['email_to'];
  3. $subject = "Re: FAQ Suggestion";
  4. $email = "d26thletter@yahoo.com";
  5. $message = $_REQUEST['message'] ;
  6. $headers = "From: $email";
  7. $sent = mail($email_to, $subject, $message, $headers) ;
  8. if($sent)
  9. {print "Your mail was sent successfully"; }
  10. else
  11. {print "We encountered an error sending your mail"; }
  12. ?>

when i run it in the localhost, i got this error message:
  1. SMTP server response: 553 We do not relay non-local mail, sorry. in C:\xampp\htdocs\FAQ\contact.php on line 15
  2. We encountered an error sending your mail

how could i make the mail() function work?
Reply With Quote Quick reply to this message  
Join Date: Apr 2009
Posts: 37
Reputation: shefeekj has a little shameless behaviour in the past 
Solved Threads: 2
shefeekj shefeekj is offline Offline
Light Poster

Re: test PHP mail() in localhost

 
0
  #2
Apr 30th, 2009
its becoz an email server is nt configured on your local machine...It wil work fine when u upload the file to the server....
Reply With Quote Quick reply to this message  
Join Date: Jan 2009
Posts: 37
Reputation: zeeyon is an unknown quantity at this point 
Solved Threads: 0
zeeyon's Avatar
zeeyon zeeyon is offline Offline
Light Poster

Re: test PHP mail() in localhost

 
0
  #3
Apr 30th, 2009
how can i configure an email server to the local? thanks ahead.
Reply With Quote Quick reply to this message  
Join Date: Nov 2007
Posts: 596
Reputation: buddylee17 has a spectacular aura about buddylee17 has a spectacular aura about 
Solved Threads: 125
buddylee17's Avatar
buddylee17 buddylee17 is offline Offline
Posting Pro

Re: test PHP mail() in localhost

 
0
  #4
Apr 30th, 2009
You'll have to use your isp's SMTP server.
See here:http://roshanbh.com.np/2007/12/sendi...vironment.html
Lost time is never found again.
- Benjamin Franklin
Reply With Quote Quick reply to this message  
Join Date: Mar 2008
Posts: 218
Reputation: kireol is an unknown quantity at this point 
Solved Threads: 33
kireol kireol is online now Online
Posting Whiz in Training

Re: test PHP mail() in localhost

 
0
  #5
Apr 30th, 2009
It depends on what OS you are running on.

Based off of the question, I'll assume you are running windows.

Buddylee17 had a great link.

On windows, I use stunnel that connects to sendmail http://www.google.com/search?q=php+s...ient=firefox-a
Reply With Quote Quick reply to this message  
Join Date: Mar 2009
Posts: 5
Reputation: sch_bern is an unknown quantity at this point 
Solved Threads: 1
sch_bern sch_bern is offline Offline
Newbie Poster

Re: test PHP mail() in localhost

 
0
  #6
Apr 30th, 2009
I agree with "shefeekj" you should configure your mail server. If you see Windows, I just wanna suggest you to follow these step using ArgoSoft:
http://www.phpeasystep.com/phptu/23.html

Good luck, buddy
Reply With Quote Quick reply to this message  
Join Date: Apr 2009
Posts: 3
Reputation: nhocikaka is an unknown quantity at this point 
Solved Threads: 1
nhocikaka nhocikaka is offline Offline
Newbie Poster

Re: test PHP mail() in localhost

 
0
  #7
Apr 30th, 2009
thingking........
http://stock4you.net
Free download psd files,psd templates, brushes, fonts, Styles, web templates
All for designer
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:




Views: 1655 | Replies: 6
Thread Tools Search this Thread



Tag cloud for PHP
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC