1

I have an error while sending e-mail through a php script. Although I changed all the required settings in php.ini like

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

I am using wamp. The received error is this:

[function.mail]: Failed to connect to mailserver at "PHP_INI_ALL" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in C:\wamp\www\mail.php on line 10

Why does this error occur ?

HamZa
  • 14,671
  • 11
  • 54
  • 75

2 Answers2

2

Wampp doesn't come with a default mail server. You have to install one yourself.

If you only need a mailserver for development purposes you can download the 'smtp4dev' from here: http://smtp4dev.codeplex.com/

From an answer on SO (https://stackoverflow.com/a/7011373/1379394)

t'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.

Hope that will help you.

Community
  • 1
  • 1
Kees Sonnema
  • 5,759
  • 6
  • 51
  • 106
2

WAMP runs on Windows, and windows does not have a Mail Server installed by default.

I would suggest hMailer as I use it myself, but it is not exactly childs play to setup.

Alternatively you could use phpMailer which is a php based utility that will help you send mail using for example a yahoo/gmail etc account.

RiggsFolly
  • 93,638
  • 21
  • 103
  • 149