PDA

View Full Version : email help


slickbet
08-27-2008, 03:20 PM
I am new to both DreamWeaver and PHP. I am running a new website on a Windows 2003 server using IIS6. I have PHP version 5 installed and tested using local host successfully. I have created a mail form in DreamWeaver and set it up with the PHP form results found on this site. The form can be filled out by a user, it goes through the script which sends it to the html page that tells the user that the form was sent successfully. All that seems to work well. The problem is the email is never received. I know the email address that the form is set to send to is valid because it's mine. I am not finding any server error messages to give me a clue on what is missing. Your help would be greatly appreciated. Thanks in advance.

domedia
08-27-2008, 03:29 PM
You have to give some more information than that.

I'm guessing the error in in your script.. but it's only a guess ;-)

slickbet
08-27-2008, 03:37 PM
Here's a copy of my script although I got it from this site and inserted my information in the form fields.


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<body>
<?php
//--------------------------Set these paramaters--------------------------
// Subject of email sent to you.
$subject = 'ContactUs Results';
// Your email address. This is where the form information will be sent.
$emailadd = 'bslechta@srhc.com';
// Where to redirect after form is processed.
$url = 'http://www.srhc.net/contactus/success.html';
// Makes all fields required. If set to '1' no field can not be empty. If set to '0' any or all fields can be empty.
$req = '1';
// --------------------------Do not edit below this line--------------------------
$text = "Results from form:\n\n";
$space = ' ';
$line = '
';
foreach ($_POST as $key => $value)
{
if ($req == '1')
{
if ($value == '')
{echo "$key is empty";die;}
}
$j = strlen($key);
if ($j >= 20)
{echo "Name of form element $key cannot be longer than 20 characters";die;}
$j = 20 - $j;
for ($i = 1; $i <= $j; $i++)
{$space .= ' ';}
$value = str_replace('\n', "$line", $value);
$conc = "{$key}:$space{$value}$line";
$text .= $conc;
$space = ' ';
}
mail($emailadd, $subject, $text, 'From: '.$emailadd.'');
echo '<META HTTP-EQUIV=Refresh CONTENT="0; URL='.$url.'">';
?>
</body>
</html>



Thanks for the quick reply. I appreciate it and hope you can shed some light.:)

davidj
08-27-2008, 03:52 PM
in your php.ini find this line


SMTP = localhost
smtp_port = 25


make sure its uncommented

davidj
08-27-2008, 03:57 PM
is this on a live machine

slickbet
08-27-2008, 04:39 PM
I checked the php.ini. It looks fine. Here's a copy.

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

I'm at a loss. Any ideas on what to look at from here?

davidj
08-27-2008, 05:24 PM
is this on a host machine or on your local machine?

slickbet
08-27-2008, 05:31 PM
This is on our local server running on our internal network. Once the website is complete the server will be natted out to allow the world to view.

davidj
08-27-2008, 06:25 PM
so is there an SMTP server installed

http://www.ilopia.com/Articles/WindowsServer2003/EmailServer.aspx

slickbet
08-27-2008, 07:00 PM
Yes, the smtp server is installed and the service is running.

davidj
08-27-2008, 07:21 PM
ok

create a file (empty with no htm)

add your php tags

add the following


mail('youraddress@domain.com', 'test', 'test', 'test');


save the page off as mail.php and then browse for it

this will send an email to the first argument (email address)

if this doesnt work then it must be a server config issue and im not that savy with it to comment further

slickbet
08-27-2008, 07:49 PM
Just to make sure I understood you, here's what the file consisted of:

<?php
mail('bslechta@srhc.com', 'test', 'test', 'test');
?>

Is that correct?

I browsed to that but nothing happened.


FYI - Before I received your last reply, I changed some of my original php script. I changed the email address from our domain name to the external ip address. Then I tested it from a pc outside of our network. It worked the same and I still received no email. I just wanted to confirm it wasn't an internal network issue.

davidj
08-27-2008, 07:53 PM
your example is correct

i reckon its a server config issue

your going to have to call the techy's to troubleshoot this further

davidj
08-27-2008, 07:54 PM
it wouldnt have anything to do with IIS ??

you could try installing apache and see if it works

im clutching at straws here

rattlsnak
08-27-2008, 10:23 PM
FWIW, I used that exact same script on Apache and it works fine.

davidj
08-27-2008, 11:06 PM
ahhh nice one

so your sorted now?

rattlsnak
08-28-2008, 12:07 AM
Ill be starting a new thread later tonight/tomorrow. I finished the last project, and now am 90% with the next one which involves the mail form. Nothing like drinking from a fire hose!! ;)

amanda
09-04-2008, 08:01 AM
Thanks for all to reply. I appreciate it and hope you can shed some light.

davidj
09-04-2008, 08:04 AM
amanda

i dont get your post

are you wanting the same help here