1

Getting error message

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

Ive opened up php.ini and i believe i need to add

SMTP "localhost" PHP_INI_ALL
smtp_port "25" PHP_INI_ALL
sendmail_from NULL PHP_INI_ALL
sendmail_path NULL PHP_INI_SYSTEM

Im not sure where to add it though? Also correct me if anything i believe i need to do is incorrect. Im currently developing website on localhost so if anything i need to please tell me.

EDIT**

My local host is XAMPP amd i believe this has a mail server

Louismoore18
  • 167
  • 3
  • 3
  • 13

4 Answers4

8

You're probably not running an SMTP server on your localhost.

If you only need an SMTP server for development purposes, and you're running Windows, install smtp4dev, which can be found here: http://smtp4dev.codeplex.com/

It's a beautiful little piece of software that sits in your task bar and lets you see all email that is being sent to it. It doesn't actually send email anywhere, so you can work with live data without fear of spamming someone.

Then, when you want your application to actually send email (when you run it on the server), you will need an SMTP server address instead of "localhost". If you don't know which SMTP to use, speak to your network administrator or ISP.

Last but not least, if you access your email through an email program, you can probably find the "Outgoing server" in your settings somewhere, although that depends on which mail program you use. An "SMTP server" and an "Outgoing server" are exactly the same thing.

Teekin
  • 12,581
  • 15
  • 55
  • 67
  • I believe my local host 'XANPP' has a mail server... i think, not 100% its mercury mail – Louismoore18 Aug 10 '11 at 13:36
  • 1
    XAMPP does **not** come with a mail server! – qJake Aug 12 '11 at 17:59
  • 1
    Louismoore18: Open up a command prompt, and type "telnet localhost 25" - if it says "Could not open connection to the host" or something to that effect, then you are NOT running one. (25 indicates the port number, SMTP runs on port 25) – Teekin Aug 12 '11 at 19:01
0

You can't send mail from your local computer if you don't have a mail server running on it. Just like everyone else has said: Make sure you have a mail server that is properly configured and up and running on your local computer, or install it on a remote computer and change the IP address/port to point to the remote computer.

qJake
  • 16,821
  • 17
  • 83
  • 135
0

You can add smtp configuration at any place, but it is a good idea to search for [mail function] section in that file and add that below. Also,

SMTP = *smtp server addr here*
smtp_port = 25

If you are not using XAMPP or some other packet of that kind, it's unlikely that you have smtp server up and running on localhost.

J0HN
  • 26,063
  • 5
  • 54
  • 85
0

you have to install a Mail Server Program to your comp.. Localhost does not support send mail in default way

WinuX
  • 1
  • 1