Jump to content


Photo

I'm new with PHP can someone please help me out with something?


  • Please log in to reply
12 replies to this topic

#1 yaqub

yaqub
  • New Members
  • Pip
  • Newbie
  • 9 posts

Posted 03 August 2006 - 06:55 AM

Hi-

I'm trying to make a simple mail form using dreamweaver and when I preview the page I get this 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\Apache Group\Apache2\htdocs\newland\message_sent.php on line 6

I'm not sure what to do here. I want to make sure that I'm headed in the right direction so can someone please let me know how or what I can change to make this work.

Also here's the dreamweaver code::

<?php
$to = "yaqoobcerbes@hotmail.com";
$subject = "This is the message subject";
$body = "This is the message body";
$headers = "From: yaqoobcerbes@hotmail.com\n";
mail($to,$subject,$body,$headers);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR...nsitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Newland Tours: About</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link href="css/newland.css" rel="stylesheet" type="text/css" />
</head>

<body>
<a href="#top"><img src="images/spacer.gif" alt="Skip to main image" width="1" height="1" border="0" align="left" /></a>
<table width="750" border="0" cellpadding="3" cellspacing="0">
<tr>
  <td><img src="images/banner_left.gif" alt="Newland Tours Banner" width="451" height="68" /></td>
  <td width="280"><img src="images/banner_right.jpg" alt="Newland Tours Banner, previous tour images" width="276" height="68" /></td>
</tr>
<tr>
  <td><img src="images/navbar.gif" name="navbar" alt="Newland Tours image" width="450" height="20" border="0" usemap="#navbarMap" /></td>
  <td><img name="copyright_bar" src="images/copyright_bar.gif" alt="Copyright 2006 Newland Tours width="272" height="20" border="0" /></td>
</tr>
<tr>
  <td colspan="2">
<h1><br />
  <a name="top" id="top"></a>Message Sent  </h1>
    <p>Your message has been sent. We will contact you soon.</p>
    <p>Return to Newland <a href="index.php">home</a>.  </p></td>
</tr>
</table>

<br />
<br />


<map name="navbarMap" id="navbarMap">
<area shape="rect" coords="1,0,62,20" href="index.php" alt="Home" />
<area shape="rect" coords="71,0,117,20" href="about.php" alt="About" />
<area shape="rect" coords="129,0,196,20" href="tours.php" alt="Find Tours" />
<area shape="rect" coords="209,0,311,20" href="profiles.php" alt="Navigation Bar" />
<area shape="rect" coords="327,0,434,20" href="contact.php" alt="Contact An Agent" />
</map>
</body>
</html>

Please give me a hand with this, it's much appreciated.

Ya'qub :D

#2 scottybwoy

scottybwoy
  • Members
  • PipPipPip
  • Advanced Member
  • 532 posts
  • LocationUK

Posted 03 August 2006 - 08:28 AM

Are you actually using a mail server on your local host.  Also check your php.ini file to check if your using the right SMTP settings

#3 yaqub

yaqub
  • New Members
  • Pip
  • Newbie
  • 9 posts

Posted 03 August 2006 - 08:02 PM

I'm new. So I'm using Apache and I have looked at the php.ini file I think. Can someone give me some step by step advice instaed of just saying have you done this or that? I'm new so for me to mess with the .ini file I would need some type of assistance.

Thanks

#4 yaqub

yaqub
  • New Members
  • Pip
  • Newbie
  • 9 posts

Posted 04 August 2006 - 08:02 AM

How do I check the SMTP settings and how do I change them? I'm using QK SMTp server I hope someone can please walk me through this step by step.

I'm having a really hard time trying to find help which is really surprising, I thought that people formed a rather tight community to help newbies get up and started.

Please anyone who's ever had this problem please walk me through what I got to do here. I know this is a common problem so everyone has gone through at one point in time.

Thanks

#5 tomfmason

tomfmason
  • Staff Alumni
  • Advanced Member
  • 1,696 posts
  • Locationstealing your wifi

Posted 04 August 2006 - 08:06 AM

are you referring to the settings in the php.ini?

Traveling East in search of instruction, and West to propagate the knowledge I have had gained.

current projects: pokersource

My Blog | My Pastebin | PHP Validation class | Backtrack linux


#6 yaqub

yaqub
  • New Members
  • Pip
  • Newbie
  • 9 posts

Posted 04 August 2006 - 08:35 AM

I think this is where I have to specify what server I'm using isn't it? From the error message it says that it's unable to find a mail server.

You tell me, I think it's basically saying I have reconfig the php.ini file to reflect what mail server I'm using. But I'm having trouble finding it(I installed apache to the default location so you should know exactly where that file is). I downloaded and installed QK SMTP mail server which is running also Apache is running obviously by the error message.

So do you have some ideas for me? I know this is a commone problem especially for newbies.

Thanks

#7 yaqub

yaqub
  • New Members
  • Pip
  • Newbie
  • 9 posts

Posted 04 August 2006 - 07:57 PM

Wow. I'm surprised no one knows about this issue. I really thought people would maybe offer a little more help to a newbie php'er

Disappointed

#8 ryanlwh

ryanlwh
  • Staff Alumni
  • Advanced Member
  • 511 posts

Posted 04 August 2006 - 08:05 PM

is the smtp server on the same computer as the apache server? is it running correctly? if you want to test the server, you can send an email with MS Outlook or MS Exchange using that smtp server and make sure that it's working properly.

you also want to see if windows firewall is configured correctly for the server and port 25. go to Control Panel->Windows Firewall->Exceptions.
Please use EDIT * 100...
Please use
or [php] * 1000...

PLEASE READ THE POSTED SOLUTIONS CAREFULLY * 1000000...

#9 kenrbnsn

kenrbnsn
  • Staff Alumni
  • Advanced Member
  • 8,235 posts
  • LocationHillsborough, NJ, USA

Posted 04 August 2006 - 08:07 PM

Create a script with this line in it:
<?php phpinfo(); ?>
and bring it up. In the output will be the location of the PHP.INI file

Ken

#10 yaqub

yaqub
  • New Members
  • Pip
  • Newbie
  • 9 posts

Posted 04 August 2006 - 09:02 PM

Thanks guys for the new tips

#11 mrparanoid

mrparanoid
  • New Members
  • Pip
  • Newbie
  • 8 posts

Posted 11 October 2006 - 10:44 PM

If the tips above does not help, have a look at pear mail function on php.net ;)

#12 whitehat

whitehat
  • Members
  • PipPip
  • Member
  • 18 posts

Posted 11 October 2006 - 10:50 PM

on windows look in C:\WINDOWS for the php.ini

find:
[mail function]
; For Win32 only.
SMTP = mail.yourhost.com <----use the mailserver from your isp

; For Win32 only.
sendmail_from = admin@yourhost.com <-- pick 1 of your emails that runs on the isp server

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




dont forget to reboot your apache... if not now how.. just reboot windows

#13 heckenschutze

heckenschutze
  • Members
  • PipPipPip
  • Advanced Member
  • 257 posts
  • LocationAustralia

Posted 11 October 2006 - 11:12 PM

you can also use ini set...

<?php
ini_set("sendmail_from", "myemail@myhost.com");
ini_set("SMTP", "mail.yourhost.com");
ini_set("smtp_port", 25);
?>




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users