[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1947
  • Last Modified:

php.ini smtp problem

I currently just installed PHP5 on IIS6 and having a problem with SMTP settings.  I edited my php.ini file in the PHP root dir.  I changed the SMTP server from localhost to the smtp server of my ISP.  I know that it doen't require auth and uses port 25.  After editing that, I restarted IIS.  After filling out the form on the webpage, i still receive the same 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

Apparently, it is still trying to use localhost as the mail server.  Can anyone tell me why???
0
SteveMat11
Asked:
SteveMat11
  • 6
  • 4
1 Solution
 
hernst42Commented:
> I edited my php.ini file in the PHP root dir.
This is not the php.ini IIS uses. Create an file with
<?php phpinfo();
Open that page via brwoser and check for:
Loaded Configuration File
Configuration File (php.ini) Path
and edit that file in that directory. Then restart IIS
0
 
SteveMat11Author Commented:
It shows it in C:/windows, i went to that dir and do not see php.ini there.
0
 
SteveMat11Author Commented:
line below that shows: Loaded Configuration File  (none)  
0
Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

 
hernst42Commented:
So copy your php.ini in from the php-root dir to c:\windows and restart IIS and try again.
0
 
SteveMat11Author Commented:
Ok, that worked but now i get another error.  Code for the form is attached first, as well as the action page below it.  The error currently reads failed to send removal request.  Like I said, this code worked fine on an apache server.  Any ideas?  Thanks for your help
<html>
<head>
<title>Remove Me From A Class</title>
</head>
<body>
<form method="POST" action="remove_me.php">
<table border="0" cellspacing="5" cellpadding="5">
<tr>
<td>Name:</td><td><input type="text" name="name" size="25" /></td>
</tr>
<tr>
<td>Badge #:</td><td><input type="text" name="badge" size="25" maxlength="3" /></td>
</tr>
<tr>
<td>Class Name:</td><td><input type="text" name="className" size="25" /></td>
</tr>
<tr>
<td>Class Date:</td><td><input type="text" name="date" size="25" /></td>
</tr>
<tr>
<td></td>
<td><input type="submit" name="submit" value="Submit Request" />&nbsp;<input type="reset" name="reset" value="Reset" /></td>
</tr>
</table>
</form>
</body>
</html>
 
 
 
 
 
--------------
 
<?php
$name = $_POST["name"];
$badge = $_POST["badge"];
$className = $_POST["className"];
$date = $_POST["date"];
$to = "***MYEMAIL@MYEMAIL.COM***";
$subject = "Class Remove Request";
$message = "$name\n$badge\n$className\n$date";
 
if (empty($name) || empty($badge) || empty($className) || empty($date)) {
echo "Please Fill In All The Fields. <a href=\"removeme.php\">Back</a>";
}
else if (!empty($name) && !empty($badge) && !empty($className) && !empty($date)) {
 
	if (mail($to, $subject, $message)) {
	echo "Request Successfully Sent";
	}
	else {
	echo "Failed to send Removal Request";
	}
}
?>

Open in new window

0
 
hernst42Commented:
Maybe your webserver is not allowd to deliver mails to that server. Ask the administrator of the mail-server to check the log or allow your webserver to deliver mails without authentication to that mailserver.
0
 
SteveMat11Author Commented:
that is the address of our isp's mail server.  I am usually able to send mail through their server without a problem or authentication.  I require auth on my own server.  Any other ideas or address of a mail host that doesnt require auth?
0
 
hernst42Commented:
Use a mailing class like http://phpmailer.sf.net or http://swiftmailer.sf.net which will produce better error messages if a mail could not get delivered.
0
 
SteveMat11Author Commented:
I will change my php.ini file to include that smtp server.  Also, does the "from" email address in the line below that matter?
0
 
SteveMat11Author Commented:
This actually worked.  I change the code around instead of using home made code.  
0

Featured Post

The 14th Annual Expert Award Winners

The results are in! Meet the top members of our 2017 Expert Awards. Congratulations to all who qualified!

  • 6
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now