OS: Windows Server 2003 SP1 Standard Edition
Web Server: Apache 2.0.59
MySQL: MySQL 5.0.24a
PHP: PHP 5.2.0
SMTP: IIS
POP3: Windows Server Built in POP3 service
[This is all on my personal machine.]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
### Data within my php.ini file
[mail function]
; For Win32 only.
SMTP = 192.168.0.10
smtp_port = 25
; For Win32 only.
sendmail_from = <!-- e --><a href="mailto:[email protected]">[email protected]</a><!-- e -->
# Note: The php.ini file is in the C:\WINDOWS directory and yes, that's where it's being referenced from.
# Note: Registered Globals are set to ON
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
### Here is my error
Warning: mail() [function.mail]: Failed to connect to mailserver at "192.168.0.10" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in C:\Apache2\htdocs\www.mysite.com\myform.php on line 75
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
### Mail function of myform.php
Line(57) <?php
Line(58) if ($StaffName)
Line(59) {
Line(60) $yeshow = "
Line(61) Summary notes/comments:
Line(62) -----------------------
Line(63)
Line(64) $Summary_notes_comments
Line(65)
Line(66) -----------------------
Line(67) FROM: $StaffTitle-$StaffName
Line(68) DEPARTMENT: $DEPARTMENT";
Line(69) }
Line(70)
Line(71) mail($toemail,"$subject","
Line(72)
Line(73) $yeshow
Line(74)
Line(75) ","From: $StaffName");
Line(76)
Line(77) header("Location: $sendpage");
Line(78) exit();
Line(79) }
Line(80) ?>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
There should be absolutely no reason (that I can see) why I receive the mail() error as stated above.
This has worked flawlessly in the past for over a year, but has failed to work recently.
For ScreenShots of my IIS SMTP settings, they're here: <!-- m --><a class="postlink" href="http://www.TheComputerProfessional.com/mailerror">http://www.TheComputerProfessional.com/mailerror</a><!-- m -->
If there's any other info you need to know and/or see to further troubleshoot this error, please let me know and I'll provide it.Firstly, you may as well use localhost (127.0.0.1).
Secondly, you need to enable relaying in IIS SMTP.
You shouldn't set its fully qualified name to an IP address.
You also need to do whatever malarky with windows firewalls etc to allow PHP to connect to SMTP.
MarkIf you look at the screenshot009.jpg you'll notice that I've opened up Relaying. All firewall has been disabled to troubleshoot this problem, so there's nothing blocking PHP to connect with SMTP or any other malarky to unblock.
(if you're not able to view screenshot009.jpg, it's the last picture here at <!-- m --><a class="postlink" href="http://www.TheComputerProfessional.com/mailerror">http://www.TheComputerProfessional.com/mailerror</a><!-- m --> )** UPDATE **
I would just like to say that I've resolved my issue.
Here is how it was resolved:
I downloaded the SMTPDIAG tool from microsoft and ran it.
Everything was passing except for the last part which gave me an "Error 10053"
After googling that error, I was pointed here: <!-- m --><a class="postlink" href="http://kbase.pscs.co.uk/index.php?article=242">http://kbase.pscs.co.uk/index.php?article=242</a><!-- m -->
It seems that McAfee was blocking port 25. After unchecking the block, presto. I can telnet port 25 and continue all SMTP functions normally.
I no longer receive the original error message that prompted this entire investigation.
I wish to thank all of you who replied and/or read this post.
Cheers to all.also, if you are just using this for testing purposes, you can put your ISP's mail server in there ie. mail.whateveryourispis.com if you don't want to rely on or open your windows box smtp port
stolzyboyNow that I've figured out the issue, I've reinstated Relay restrictions and firewall(s). Besides, my ISP utilizes an authorizational SMTP port that's quite restrictive. I only use my ISP's SMTP to send mail "outside". Thanks though.
Web Server: Apache 2.0.59
MySQL: MySQL 5.0.24a
PHP: PHP 5.2.0
SMTP: IIS
POP3: Windows Server Built in POP3 service
[This is all on my personal machine.]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
### Data within my php.ini file
[mail function]
; For Win32 only.
SMTP = 192.168.0.10
smtp_port = 25
; For Win32 only.
sendmail_from = <!-- e --><a href="mailto:[email protected]">[email protected]</a><!-- e -->
# Note: The php.ini file is in the C:\WINDOWS directory and yes, that's where it's being referenced from.
# Note: Registered Globals are set to ON
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
### Here is my error
Warning: mail() [function.mail]: Failed to connect to mailserver at "192.168.0.10" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in C:\Apache2\htdocs\www.mysite.com\myform.php on line 75
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
### Mail function of myform.php
Line(57) <?php
Line(58) if ($StaffName)
Line(59) {
Line(60) $yeshow = "
Line(61) Summary notes/comments:
Line(62) -----------------------
Line(63)
Line(64) $Summary_notes_comments
Line(65)
Line(66) -----------------------
Line(67) FROM: $StaffTitle-$StaffName
Line(68) DEPARTMENT: $DEPARTMENT";
Line(69) }
Line(70)
Line(71) mail($toemail,"$subject","
Line(72)
Line(73) $yeshow
Line(74)
Line(75) ","From: $StaffName");
Line(76)
Line(77) header("Location: $sendpage");
Line(78) exit();
Line(79) }
Line(80) ?>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
There should be absolutely no reason (that I can see) why I receive the mail() error as stated above.
This has worked flawlessly in the past for over a year, but has failed to work recently.
For ScreenShots of my IIS SMTP settings, they're here: <!-- m --><a class="postlink" href="http://www.TheComputerProfessional.com/mailerror">http://www.TheComputerProfessional.com/mailerror</a><!-- m -->
If there's any other info you need to know and/or see to further troubleshoot this error, please let me know and I'll provide it.Firstly, you may as well use localhost (127.0.0.1).
Secondly, you need to enable relaying in IIS SMTP.
You shouldn't set its fully qualified name to an IP address.
You also need to do whatever malarky with windows firewalls etc to allow PHP to connect to SMTP.
MarkIf you look at the screenshot009.jpg you'll notice that I've opened up Relaying. All firewall has been disabled to troubleshoot this problem, so there's nothing blocking PHP to connect with SMTP or any other malarky to unblock.
(if you're not able to view screenshot009.jpg, it's the last picture here at <!-- m --><a class="postlink" href="http://www.TheComputerProfessional.com/mailerror">http://www.TheComputerProfessional.com/mailerror</a><!-- m --> )** UPDATE **
I would just like to say that I've resolved my issue.
Here is how it was resolved:
I downloaded the SMTPDIAG tool from microsoft and ran it.
Everything was passing except for the last part which gave me an "Error 10053"
After googling that error, I was pointed here: <!-- m --><a class="postlink" href="http://kbase.pscs.co.uk/index.php?article=242">http://kbase.pscs.co.uk/index.php?article=242</a><!-- m -->
It seems that McAfee was blocking port 25. After unchecking the block, presto. I can telnet port 25 and continue all SMTP functions normally.
I no longer receive the original error message that prompted this entire investigation.
I wish to thank all of you who replied and/or read this post.
Cheers to all.also, if you are just using this for testing purposes, you can put your ISP's mail server in there ie. mail.whateveryourispis.com if you don't want to rely on or open your windows box smtp port
stolzyboyNow that I've figured out the issue, I've reinstated Relay restrictions and firewall(s). Besides, my ISP utilizes an authorizational SMTP port that's quite restrictive. I only use my ISP's SMTP to send mail "outside". Thanks though.