php - How do I test contact form in Windows XP using XAMPP through localhost? -


i have coded web site scratch xhtml, using windows xp pro, , includes contact form in php. web site in xampp folder on c drive , being run under localhost on computer @ home.

i want test form sending email test message live email address. have tried changing smtp = localhost in php .ini file isp server address, activating line,

sendmail_path = "\"c:\xampp\sendmail\sendmail.exe\" -t"  

and adding semicolon beginning of line below,

sendmail_path = "c:\xampp\mailtodisk\mailtodisk.exe"   

i have placed live email address in contact form code so:

<?php  //send email      if(mail('my@emailaddress.net','contact   form',$msg, 'from:postmaster@localhost')) {  ?> 

then tried way placing email address under if(post) function instead:

<?php  if($_post) {  $fname = $_post['fname'];  $femail = $_post['femail'];  $fcomments = $_post['fcomments'];  $fcaptcha = $_post['fcaptcha'];  $random_string = $_post['random_string'];  $to = "myemailaddress@myisp.net";  ?> 

and changed mail function lower down in script accordingly:

<?php  //send email  mail($to, $fname, $femail, $fcomments);  if(mail($to,'contact form',$msg, 'from:postmaster@localhost')) {      header("location: ../email-thankyou.htm");  ?> 

when clicked on submit button, generated error page isp server first time, , firefox browser during later attempts, happening, in looking @ live email account there no sign of message arriving.

i found form disappeared , left background colour of page, when clicking on submit button when tried second method.

i have searched through stack overflow similar queries, , tried few suggestions without success.

i using xampp version 3.1.0.3.1.0. although conversant xhtml coding, complete novice regards php programming, project using php first effort grips it, , appreciate , advice given, particularly writing mail($to, , if(mail($to, out correctly.

i have found answer question downloading , installing smtp4dev 2009 on c drive. little program in conjunction xampp, can test contact form , receives messages successfully. other thing needed to configure xampp php ini file follows:

[mail function] ; xampp: comment out if want work smtp server mercury  smtp = localhost  smtp_port = 25  ; win32 only. ; http://php.net/sendmail-from sendmail_from = postmaster@localhost  ; xampp important note (1): if xampp installed in base directory spaces      (e.g. c:\program filesc:\xampp) fakemail , mailtodisk not work correctly. ; xampp important note (2): in case please copy sendmail or mailtodisk folder in root folder (e.g. c:\sendmail) , use sendmail_path.    ; xampp: comment out if want work fakemail forwarding  mailbox (sendmail.exe in sendmail folder) ;sendmail_path = "\"c:\xampp\sendmail\sendmail.exe\" -t"  ; xampp: comment out if want work mailtodisk, writes mails in c:\xampp\mailoutput folder ;sendmail_path = "c:\xampp\mailtodisk\mailtodisk.exe" 

as far earlier problem of form disappearing when clicking on send button, concerned - part of script in wrong place , after trial , error in positioning it, problem solved.

you want set mercury or local mail server able this. mecury comes installed xampp.

http://www.youtube.com/watch?v=vu4pt7xmso0


Comments

Popular posts from this blog

javascript - Count length of each class -

What design pattern is this code in Javascript? -

hadoop - Restrict secondarynamenode to be installed and run on any other node in the cluster -