Hi, I've got this error while testing one of my php script.
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
How can I debug this?
Printable View
Hi, I've got this error while testing one of my php script.
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
How can I debug this?
You do not have a SMTP server running on your localhost. Just change the php ini settings. On windows it's normaly in the C:\Windows or C:\Winnt Folder.
Change it to your ISP SMTP server and then the error message you are recieve will disapear.Code:[mail function]
; For Win32 only.
SMTP = Your.ISP.SMTP.Server; for Win32 only
yea i remember having that problem 2 but i just downloaded a PostCast Server cause changing the ini settings didnt work
Thanks for the tips but my isp smtp server doesn't seems to work. Can I input other smtp server?
What error do you get when you are attempting to connect the the SMTP server?
if site is on ur own comp i think smpt is localhost but if site is on another server u have to contact them for the smpt and activate main in the php ini file if u have administrative capability or use the ini_set(); to temporarily activate mail for the duration of that script
Thanks for the replies :)
My error is
Warning: mail() [function.mail]: Failed to connect to mailserver at "smtp.isp.com" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in c:\Inetpub\wwwroot\Mail.php on line 167
1 mail have been sent to [email protected]
Time Acquired: 0.0127399143782 seconds.
Text Formatting : Plain Text
The smtp server I try change to my isp smtp server and localhost and it won't work. Port is 25 right? I think is the bold step need to be edited but I not sure how? Please tell me more about ini_set(); settings, Thanks :)
Are the PHP scripts running on your own system or are you using a web host. If you are using a web host then you need to contact them and ask them for details of the address of the SMTP server you need to use.
its running on my own system using IIS with PHP.
I assume you are sending the email using the same server you use to send emails from your computer normally. It appears that PHP is unable to connect to the SMTP server there could be a number of reasons for this. But the first thing to do is attempt to connect using telnet. If you cannot then this means the ISP is blocking your connection to the server. To test the connection using telnet follow these steps:
[list][*]Type cmd at Start Menu --> Run[*]At the command prompt enter the following:
If you don't get a message like above, but instead receive a timeout or connection refused message, it means that it has been blocked.Code:C:>telnet address.isps.smtp.server.com 25
220 address.isps.smtp.server.com Microsoft ESMTP MAIL Service, Version: 6.0.3790.1830 ready at Thu, 1
Sep 2005 13:52:03 +0100
Thanks but it still not working, I try my isp smtp server like telnet isp.smtp.com 25 and it did give me a reply like 220 isp20.smtp.com ESMTP ; Sat, 3 Sep 2005 19:59:02
+0800 with a isp20 . But I try both smtp server also won't work and give me the same error msg in my php file. So sad :(