Script Help - SmoothFeedback.php

 
Post new topic   Reply to topic    Aprelium Forum Index -> PHP
View previous topic :: View next topic  
Author Message
richardyork
-


Joined: 22 Jun 2004
Posts: 411
Location: United Kingdom

PostPosted: Fri Feb 25, 2005 6:49 pm    Post subject: Script Help - SmoothFeedback.php Reply with quote

Hi Everyone,

I had this simple script ages ago and now I've found it again, I want to use it, but....it won't work now :-(

I've set display_errors=Off and register_globals=On. I think thats right? I have only just re-installed PHP and I've forgotten...lol

It says that the email has been sent sucessfully but also gives an error saying that the email couldn't be sent!! It does not work because it is supposed to send an email to me with the comments etc and it dosn't!

Could you help me get it working again please? Heres the code:

Code:
<?php

/* Edit this section */
$to = "user@domain.com"; // E-mail address the feedback is to be sent to
$subject = "Domain.ext Feedback"; // Subject of the e-mail that the feedback will be in
$afterpg = "page.htm"; // Page to be linked to after feedback is submitted (e.g. index.htm)
/* DO NOT EDIT BELOW THIS LINE (Unless you know what you are doing) */

error_reporting(1);

# Compliance check
if($to == "user@domain.com") {
print "Please ensure that you have editted this file, as it told you to!";
exit;
}

# Mail the result
if(isset($submit) && ($email) && ($message)) {
if (eregi("^([_a-z0-9-]+)(\.[_a-z0-9-]+)*@([a-z0-9-]+)(\.[a-z0-9-]+)*(\.[a-z]{2,4})$", $email)) {
print "<br><center><font face='Verdana' size='3'><b>Success! Your feedback was sent successfully - Thank-you.</b><br>Click <a href='".$afterpg."'>here</a> to continue...</font><br><br></center>";

mail($to, $subject, "$message

IP: $REMOTE_ADDR", "From: $email") or print "ERROR: Mail was not sent";
}
}
?>

<p align="center"><font size="4" face="Verdana"><strong>Feedback</strong></font></p>

<form method="post" action="<?=$PHP_SELF;?>">
<font face="Verdana" size="1">Your e-mail address:</font><br>
<input type="text" size="20" maxlength="72" name="email" value="<?=$email;?>"><?if(isset($submit) && (!$email)) {echo "&nbsp;<font face='Verdana' size='1' color='#FF0000'><b>Enter your e-mail address</b></font>";} elseif (isset($submit) && !eregi("^([_a-z0-9-]+)(\.[_a-z0-9-]+)*@([a-z0-9-]+)(\.[a-z0-9-]+)*(\.[a-z]{2,4})$", $email)) {echo "&nbsp;<font face='Verdana' size='1' color='#FF0000'><b>Enter a valid e-mail address</b></font>";}?><br><br>
<font face="Verdana" size="1">Your message:</font><br>
<textarea name="message" rows="6" cols="40"><?=$message;?></textarea><?if(isset($submit) && (!$message)) {echo "&nbsp;<font face='Verdana' size='1' color='#FF0000'><b>Enter your message</b></font>";}?><br>
<p><input type="submit" name="submit" value="Send"></p>
</form>


If you need any more info, just ask!

Thank You!
_________________
Please SEARCH the forums BEFORE asking questions!
Back to top View user's profile Send private message
Goatie.dk
-


Joined: 11 Feb 2005
Posts: 125
Location: Denmark > Herning

PostPosted: Mon Feb 28, 2005 2:36 am    Post subject: Reply with quote

I had the same problem when i wanted to set up an email form...
My knowledge in PHP isn't so great but I fixed the problem by doing a little research.
What I did to fix the problem was going into the php.ini file and change a little thing.
Here goes:

Find the line in the php.ini file that says
Code:
[mail function]

Change the settings to your email settings and save the file.

My php.ini file looks like this:
Code:
[mail function]
; For Win32 only.
SMTP = smtp.mail.dk ; for Win32 only
smtp_port = 25
sendmail_from= me@localhost.com ; for Win32 only

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

; For Unix only.  You may supply arguments as well (default: "sendmail -t -i").
;sendmail_path =

Since I don't know much about PHP I just changed the 'SMTP'- and 'smtp_port'-lines to the settings I use when I normally send emails from my email client which is Microsoft Outlook Express.

Try to change those settings in your php.ini file and see if that fixes your problem... good luck ;)
Back to top View user's profile Send private message
Goatie.dk
-


Joined: 11 Feb 2005
Posts: 125
Location: Denmark > Herning

PostPosted: Mon Feb 28, 2005 2:40 am    Post subject: Reply with quote

Oh, by the way...
You have to change the settings to those you got from your ISP (internet service provider)...
Back to top View user's profile Send private message
k1ll3rdr4g0n
-


Joined: 04 Jul 2004
Posts: 609

PostPosted: Mon Feb 28, 2005 3:56 am    Post subject: Reply with quote

No he doesnt if hes running an SMTP server.
_________________
Back to top View user's profile Send private message AIM Address
Goatie.dk
-


Joined: 11 Feb 2005
Posts: 125
Location: Denmark > Herning

PostPosted: Mon Feb 28, 2005 6:01 am    Post subject: Reply with quote

yeah ok... I just figured he only was running a webserver...
Back to top View user's profile Send private message
richardyork
-


Joined: 22 Jun 2004
Posts: 411
Location: United Kingdom

PostPosted: Mon Feb 28, 2005 2:07 pm    Post subject: Reply with quote

So I need a mail server then? I do have one but I couldn't be bothered with it because I had lots of problems last time!! I'll try it and see what happens!

Thank You!
_________________
Please SEARCH the forums BEFORE asking questions!
Back to top View user's profile Send private message
k1ll3rdr4g0n
-


Joined: 04 Jul 2004
Posts: 609

PostPosted: Mon Feb 28, 2005 4:58 pm    Post subject: Reply with quote

You dont need one if your ISP is giving you an email addy. But I would rather use my own over my ISP. (More control...)
_________________
Back to top View user's profile Send private message AIM Address
richardyork
-


Joined: 22 Jun 2004
Posts: 411
Location: United Kingdom

PostPosted: Mon Feb 28, 2005 6:47 pm    Post subject: Reply with quote

Thank You!

Got ArGoSoft and the script works now!! ;-)
_________________
Please SEARCH the forums BEFORE asking questions!
Back to top View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Aprelium Forum Index -> PHP All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB phpBB Group